Default all #23
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
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| changes: | |
| name: Check Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| api: ${{ steps.filter.outputs.api }} | |
| generator: ${{ steps.filter.outputs.generator }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: dorny/paths-filter@v2 | |
| id: filter | |
| with: | |
| filters: | | |
| api: | |
| - 'api/**.proto' | |
| generator: | |
| - 'main.go' | |
| - 'generator/**/!(*_test).go' | |
| lint: | |
| name: Lint | |
| needs: | |
| - changes | |
| if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.generator == 'true' }} | |
| uses: ./.github/workflows/lint.yaml | |
| with: | |
| lint_proto: true | |
| lint_go: true | |
| release: | |
| name: Release | |
| needs: | |
| - changes | |
| - lint | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.changes.outputs.generator == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Go Setup | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: '1.20' | |
| check-latest: true | |
| cache: true | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| version=$(git describe --abbrev=0 --match "v*.*.*" || echo "v0.1.0") | |
| echo ::set-output name=version::$version | |
| - name: Next Version | |
| uses: technicallyjosh/next-version-action@v1 | |
| id: version | |
| with: | |
| version: ${{ steps.get_version.outputs.version }} | |
| type: minor | |
| - name: Tag | |
| uses: rickstaa/action-create-tag@v1 | |
| with: | |
| tag: ${{ steps.version.outputs.next_version }} | |
| - uses: goreleaser/goreleaser-action@v4 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --rm-dist | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Rollback | |
| if: failure() | |
| run: git push --delete origin ${{ steps.version.outputs.version_tag }} |