Skip to content

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ on:
88
# Run every Saturday at 3:17 AM UTC
99
- cron: '17 3 * * 6'
1010

11+
# Cancel in-progress runs of the same workflow
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions: {}
17+
1118
jobs:
1219
linux-x86_64:
1320
runs-on: ubuntu-latest
@@ -86,23 +93,33 @@ jobs:
8693
- target: zig
8794
implementation: '0.15.2'
8895

96+
permissions:
97+
contents: read
98+
packages: write # Needed to publish Docker images to GitHub Packages
99+
env:
100+
TARGET: ${{ matrix.image.target }}
101+
IMPL: ${{ matrix.image.implementation }}
89102
steps:
90103
- name: Dump matrix context
91104
env:
92105
MATRIX_CONTEXT: ${{ toJson(matrix) }}
93106
run: echo "$MATRIX_CONTEXT"
94107
- name: checkout
95108
uses: actions/checkout@v5
109+
with:
110+
persist-credentials: false
96111
- name: build
97112
run: |
98-
cd "src/${{ matrix.image.target }}/${{ matrix.image.implementation }}-linux-x86_64"
113+
cd "src/$TARGET/$IMPL-linux-x86_64"
99114
./build
100115
- name: login
116+
env:
117+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101118
run: |
102-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
119+
echo "$GH_TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
103120
- name: tag
104121
run: |
105-
docker tag "kaitai-${{ matrix.image.target }}-${{ matrix.image.implementation }}-linux-x86_64" "ghcr.io/kaitai-io/kaitai-${{ matrix.image.target }}-${{ matrix.image.implementation }}-linux-x86_64:latest"
122+
docker tag "kaitai-$TARGET-$IMPL-linux-x86_64" "ghcr.io/kaitai-io/kaitai-$TARGET-$IMPL-linux-x86_64:latest"
106123
- name: publish
107124
run: |
108-
docker push "ghcr.io/kaitai-io/kaitai-${{ matrix.image.target }}-${{ matrix.image.implementation }}-linux-x86_64:latest"
125+
docker push "ghcr.io/kaitai-io/kaitai-$TARGET-$IMPL-linux-x86_64:latest"

0 commit comments

Comments
 (0)