Fix bug where mapper visualize could get the wrong target namespace (… #124
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
concurrency: | |
group: "${{ github.repository }}${{ github.ref }}-release" | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} # macOS is used for macOS notarization | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
cache: true | |
- name: Install dependencies | |
if: matrix.os == 'macos-latest' | |
run: |- | |
brew install coreutils | |
brew install mitchellh/gon/gon | |
- name: Import Code-Signing Certificates | |
if: matrix.os == 'macos-latest' | |
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071 | |
with: | |
# The certificates in a PKCS12 file encoded as a base64 string | |
p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
# The password used to import the PKCS12 file. | |
p12-password: ${{ secrets.P12_PASSWORD }} | |
- name: Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: |- | |
sudo apt install -y coreutils | |
- uses: goreleaser/goreleaser-action@v2 | |
with: | |
distribution: goreleaser-pro | |
version: latest | |
args: release --clean --split | |
env: | |
GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
CGO_ENABLED: "1" | |
- shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v3 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
path: dist/linux | |
name: linux-${{ env.sha_short }} | |
- uses: actions/upload-artifact@v3 | |
if: matrix.os == 'macos-latest' | |
with: | |
path: dist/darwin | |
name: darwin-${{ env.sha_short }} | |
- uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
path: dist/windows | |
name: windows-${{ env.sha_short }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
cache: true | |
- name: GCP auth | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.B64_GCLOUD_SERVICE_ACCOUNT_JSON }} | |
# copy the caches from prepare | |
- shell: bash | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist/linux | |
name: linux-${{ env.sha_short }} | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist/darwin | |
name: darwin-${{ env.sha_short }} | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist/windows | |
name: windows-${{ env.sha_short }} | |
- name: Fix goreleaser artifact paths | |
run: |- | |
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/linux/artifacts.json | |
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/darwin/artifacts.json | |
sed -i -E "s/(\"path\": \")(.*)otterize-cli\/dist/\1\/home\/runner\/work\/otterize-cli\/otterize-cli\/dist/g" dist/windows/artifacts.json | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
# release | |
- uses: goreleaser/goreleaser-action@v3 | |
with: | |
distribution: goreleaser-pro | |
version: latest | |
args: continue --merge | |
env: | |
GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
# This next bit checks out the homebrew repo | |
# and updates the formula to the latest version. | |
# For macOS, we need to modify the hashes for the zips ot match | |
# those of the notarized ZIPs, rather than the build output zips. | |
- name: Checkout homebrew-otterize | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
repository: otterize/homebrew-otterize | |
path: ./homebrew-otterize | |
update-docs: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout docs | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
repository: otterize/docs | |
path: ./docs | |
- name: Update docs | |
run: |- | |
cd ./docs | |
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version | |
LAST_TAG=`cat docs/_common/install-otterize-cli.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'` | |
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" docs/_common/install-otterize-cli.md | |
git config --global user.name "otterizebot" | |
git config --global user.email "otterizebot@users.noreply.github.com" | |
git add ./docs/_common/install-otterize-cli.md | |
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}' | |
git push origin main | |
update-mapper-readme: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout docs | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
repository: otterize/network-mapper | |
path: ./network-mapper | |
- name: Update readme | |
run: |- | |
cd ./network-mapper | |
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version | |
LAST_TAG=`cat README.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'` | |
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" README.md | |
git config --global user.name "otterizebot" | |
git config --global user.email "otterizebot@users.noreply.github.com" | |
git add README.md | |
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}' | |
git push origin main | |
update-cli-readme: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout CLI | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
path: ./cli | |
ref: main | |
- name: Update readme | |
run: |- | |
cd ./cli | |
# Find a line with get.otterize.com split by "/" and take the 5th part that contains the version | |
LAST_TAG=`cat README.md | grep get.otterize.com | head -n 1 | awk -F '/' '{print $5}'` | |
sed -i.bak "s/$LAST_TAG/${{ github.ref_name }}/g" README.md | |
git config --global user.name "otterizebot" | |
git config --global user.email "otterizebot@users.noreply.github.com" | |
git add README.md | |
git commit -m 'Update otterize-cli version to ${{ github.ref_name }}' | |
git push origin main |