|
1 | 1 | name: Build |
2 | | -on: pull_request |
| 2 | +permissions: read-all |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
3 | 7 | jobs: |
4 | | - build: |
| 8 | + build-binaries: |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + actions: write |
5 | 12 | runs-on: ubuntu-latest |
6 | 13 | steps: |
7 | | - - name: Checkout |
8 | | - uses: actions/checkout@v4 |
| 14 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
9 | 15 | with: |
10 | 16 | ref: ${{ github.event.pull_request.head.sha }} |
11 | | - - name: Install Go |
12 | | - uses: actions/setup-go@v5 |
| 17 | + - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 |
13 | 18 | with: |
14 | 19 | go-version: stable |
15 | | - - name: Set up environment |
16 | | - run: echo "GOVERSION=$(go version)" >> "$GITHUB_ENV" |
17 | | - - name: Run GoReleaser |
18 | | - uses: goreleaser/goreleaser-action@v5 |
| 20 | + - run: echo "GOVERSION=$(go version)" >> "$GITHUB_ENV" |
| 21 | + - uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 |
19 | 22 | with: |
20 | 23 | version: latest |
21 | 24 | args: build --snapshot --clean |
22 | | - - name: Tar up binaries |
| 25 | + - name: Upload binary artifacts |
23 | 26 | # work around limitations in the upload/download artifact actions |
24 | 27 | # https://github.com/actions/download-artifact#limitations |
25 | 28 | run: tar -cvf dist.tar dist |
26 | 29 | - name: Upload binaries tar file |
27 | | - uses: actions/upload-artifact@v3 |
| 30 | + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 |
28 | 31 | with: |
29 | 32 | name: dist.tar |
30 | 33 | path: dist.tar |
31 | | - buildimage: |
| 34 | + build-images: |
32 | 35 | permissions: |
| 36 | + contents: read |
| 37 | + actions: read |
33 | 38 | packages: write |
34 | 39 | id-token: write |
35 | 40 | if: ${{ !startsWith(github.head_ref, 'dependabot/') }} |
36 | 41 | strategy: |
37 | 42 | matrix: |
38 | 43 | binary: |
39 | 44 | - go-cli-github |
40 | | - needs: build |
| 45 | + needs: build-binaries |
41 | 46 | runs-on: ubuntu-latest |
42 | 47 | steps: |
43 | | - - name: Checkout |
44 | | - uses: actions/checkout@v4 |
45 | | - - name: Download binaries tar file |
46 | | - uses: actions/download-artifact@v3 |
| 48 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 49 | + - name: Download binary artifacts |
| 50 | + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 |
47 | 51 | with: |
48 | 52 | name: dist.tar |
49 | 53 | - name: Untar binaries |
50 | 54 | run: tar -xvf dist.tar |
51 | 55 | - name: Login to GHCR |
52 | | - uses: docker/login-action@v3 |
| 56 | + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 |
53 | 57 | with: |
54 | 58 | registry: ghcr.io |
55 | 59 | username: ${{ github.repository_owner }} |
56 | 60 | password: ${{ secrets.GITHUB_TOKEN }} |
57 | | - - name: Docker metadata |
58 | | - # this id is namespaced per matrix run |
| 61 | + - name: Get Docker metadata |
59 | 62 | id: docker_metadata |
60 | | - uses: docker/metadata-action@v5 |
| 63 | + uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0 |
61 | 64 | with: |
62 | 65 | images: ghcr.io/${{ github.repository }}/${{ matrix.binary }} |
63 | 66 | - name: Build and push ${{ matrix.binary }} container image |
64 | 67 | id: docker_build |
65 | | - uses: docker/build-push-action@v5 |
| 68 | + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 |
66 | 69 | with: |
67 | 70 | push: true |
68 | 71 | tags: ${{ steps.docker_metadata.outputs.tags }} |
|
0 commit comments