Ignore trace and metrics #9
This file contains hidden or 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: CI/CD | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ "v*" ] | |
| jobs: | |
| ci-cd: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| cache: true | |
| - name: Configure Git for private modules | |
| run: git config --global url."https://${{ secrets.CQRS_READ_TOKEN }}@github.com/inklabs/cqrs".insteadOf "https://github.com/inklabs/cqrs" | |
| - name: Go Mod Download | |
| run: go mod download | |
| env: | |
| GOPRIVATE: github.com/inklabs/cqrs | |
| - name: Go Mod Verify | |
| run: go mod verify | |
| - name: Install Dependencies | |
| run: ./build/install-deps.sh | |
| - name: Go Generate | |
| run: go generate . | |
| - name: Go Test | |
| run: go test -v -count 1 -race -failfast ./... | |
| - name: Get version | |
| id: vars | |
| run: echo "version=$(git describe --tags --always --dirty)" >> $GITHUB_OUTPUT | |
| - name: Build | |
| run: ./build/build-release.sh ${{ steps.vars.outputs.version }} | |
| - name: Purge Latest | |
| if: ${{ github.ref_type != 'tag' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release delete latest -y | |
| - name: Update Latest Release | |
| id: gh_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_type == 'tag' && steps.vars.outputs.version || 'latest' }} | |
| name: ${{ github.ref_type == 'tag' && format('Release {0}', steps.vars.outputs.version) || format('Latest Build {0}', steps.vars.outputs.version )}} | |
| body: | | |
| Version: ${{ steps.vars.outputs.version }} | |
| Commit: ${{ github.sha }} | |
| draft: false | |
| prerelease: ${{ github.ref_type != 'tag' }} | |
| files: release/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Output Release Info | |
| run: | | |
| echo "Release: ${{ steps.gh_release.outputs.url }}" >> $GITHUB_STEP_SUMMARY | |
| echo "API: https://api.github.com/repos/inklabs/vote/releases/${{ steps.gh_release.outputs.id }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Deploy | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.LAUNCH_TOKEN }}" \ | |
| "${{ secrets.LAUNCH_BASE_URL }}/release/vote-api/${{ steps.gh_release.outputs.id }}" |