|
| 1 | +--- |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "*" |
| 6 | + tags: |
| 7 | + - "v*.*.*" |
| 8 | + |
| 9 | +jobs: |
| 10 | + pre-commit: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + |
| 15 | + - uses: actions/setup-go@v2 |
| 16 | + with: |
| 17 | + go-version: '1.20' |
| 18 | + |
| 19 | + - uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: '3.11' |
| 22 | + |
| 23 | + - name: Setup |
| 24 | + run: make setup |
| 25 | + |
| 26 | + - name: Run pre-commit |
| 27 | + run: make pre-commit-all |
| 28 | + env: |
| 29 | + SKIP: "no-commit-to-branch" |
| 30 | + |
| 31 | + release-binary: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/main') |
| 34 | + needs: |
| 35 | + - pre-commit |
| 36 | + steps: |
| 37 | + - name: Check out the repo |
| 38 | + uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - name: Generate a token |
| 41 | + id: generate_token |
| 42 | + uses: actions/create-github-app-token@v1 |
| 43 | + with: |
| 44 | + app-id: ${{ secrets.CICD_APP_ID }} |
| 45 | + private-key: ${{ secrets.CICD_APP_PRIVATE_KEY }} |
| 46 | + |
| 47 | + - name: Run GoReleaser |
| 48 | + uses: goreleaser/goreleaser-action@v4 |
| 49 | + with: |
| 50 | + distribution: goreleaser |
| 51 | + version: latest |
| 52 | + args: release --rm-dist |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: "${{ steps.generate_token.outputs.token }}" |
| 55 | + |
| 56 | + semantic-release: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 59 | + needs: |
| 60 | + - pre-commit |
| 61 | + steps: |
| 62 | + - name: Checkout |
| 63 | + uses: actions/checkout@v3 |
| 64 | + with: |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Generate a token |
| 68 | + id: generate_token |
| 69 | + uses: actions/create-github-app-token@v1 |
| 70 | + with: |
| 71 | + app-id: ${{ secrets.CICD_APP_ID }} |
| 72 | + private-key: ${{ secrets.CICD_APP_PRIVATE_KEY }} |
| 73 | + |
| 74 | + - name: Semantic Release |
| 75 | + uses: cycjimmy/semantic-release-action@v3 |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: "${{ steps.generate_token.outputs.token }}" |
0 commit comments