|
6 | 6 | permissions: |
7 | 7 | contents: write |
8 | 8 | jobs: |
| 9 | + prepare: |
| 10 | + name: Prepare |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v5 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + - uses: actions/setup-go@v6 |
| 20 | + with: |
| 21 | + go-version-file: 'go.mod' |
| 22 | + cache: true |
| 23 | + - shell: bash |
| 24 | + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |
| 25 | + - uses: actions/cache@v4 |
| 26 | + if: matrix.os == 'ubuntu-latest' |
| 27 | + with: |
| 28 | + path: dist/linux |
| 29 | + key: linux-${{ env.sha_short }}${{ env.flags }} |
| 30 | + - uses: actions/cache@v4 |
| 31 | + if: matrix.os == 'macos-latest' |
| 32 | + with: |
| 33 | + path: dist/darwin |
| 34 | + key: darwin-${{ env.sha_short }}${{ env.flags }} |
| 35 | + - uses: actions/cache@v4 |
| 36 | + if: matrix.os == 'windows-latest' |
| 37 | + with: |
| 38 | + path: dist/windows |
| 39 | + key: windows-${{ env.sha_short }}${{ env.flags }} |
| 40 | + enableCrossOsArchive: true |
| 41 | + - name: Import GPG key |
| 42 | + |
| 43 | + id: import_gpg |
| 44 | + with: |
| 45 | + gpg_private_key: ${{ secrets.PLURAL_GPG_PRIVATE_KEY }} |
| 46 | + passphrase: ${{ secrets.PLURAL_GPG_KEY_PASSWORD }} |
| 47 | + - uses: goreleaser/goreleaser-action@v6 |
| 48 | + with: |
| 49 | + distribution: goreleaser-pro |
| 50 | + version: '~> v2' |
| 51 | + args: release --clean --split |
| 52 | + env: |
| 53 | + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
9 | 56 | release: |
10 | 57 | name: Release |
11 | 58 | runs-on: ubuntu-latest |
| 59 | + env: |
| 60 | + DOCKER_CLI_EXPERIMENTAL: "enabled" |
| 61 | + needs: prepare |
12 | 62 | steps: |
13 | 63 | - uses: jlumbroso/[email protected] |
14 | 64 | with: |
15 | 65 | tool-cache: false |
16 | | - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 |
| 66 | + - uses: actions/checkout@v5 |
17 | 67 | with: |
18 | 68 | fetch-depth: 0 |
19 | | - - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 |
| 69 | + - uses: actions/setup-go@v6 |
20 | 70 | with: |
21 | 71 | go-version-file: 'go.mod' |
22 | 72 | cache: true |
| 73 | + - shell: bash |
| 74 | + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |
| 75 | + - uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: dist/linux |
| 78 | + key: linux-${{ env.sha_short }}${{ env.flags }} |
| 79 | + - uses: actions/cache@v4 |
| 80 | + with: |
| 81 | + path: dist/darwin |
| 82 | + key: darwin-${{ env.sha_short }}${{ env.flags }} |
| 83 | + - uses: actions/cache@v4 |
| 84 | + with: |
| 85 | + path: dist/windows |
| 86 | + key: windows-${{ env.sha_short }}${{ env.flags }} |
| 87 | + enableCrossOsArchive: true |
23 | 88 | - name: Import GPG key |
24 | | - uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0 |
| 89 | + uses: crazy-max/ghaction-import-gpg@v6.3.0 |
25 | 90 | id: import_gpg |
26 | 91 | with: |
27 | 92 | gpg_private_key: ${{ secrets.PLURAL_GPG_PRIVATE_KEY }} |
28 | 93 | passphrase: ${{ secrets.PLURAL_GPG_KEY_PASSWORD }} |
29 | | - - name: Run GoReleaser |
30 | | - uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0 |
| 94 | + - uses: goreleaser/goreleaser-action@v6 |
| 95 | + if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit |
31 | 96 | with: |
32 | | - args: release --clean |
| 97 | + distribution: goreleaser-pro |
| 98 | + version: '~> v2' |
| 99 | + args: continue --merge |
33 | 100 | env: |
| 101 | + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
34 | 102 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
35 | 103 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
0 commit comments