Skip to content

Commit 38efa56

Browse files
committed
Fixes for error handling and permissions
Signed-off-by: Samuel Monson <[email protected]>
1 parent 59c1be8 commit 38efa56

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/container-maintenance.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
concurrency:
1010
group: ${{ github.workflow }}
1111

12+
permissions:
13+
packages: write
14+
1215
jobs:
1316
cleanup-container-tags:
1417
runs-on: ubuntu-latest
@@ -36,13 +39,15 @@ jobs:
3639
registry: ghcr.io/${{ github.repository_owner }}
3740
- name: Get list of tags
3841
run: |
42+
# Fail step if any command fails
43+
set -euo pipefail
3944
skopeo list-tags docker://${{ github.repository }} | jq --raw-output '.Tags[]' > tags
4045
- name: Get latest release and rc tags
4146
run: |
4247
STABLE_TAG="$(grep -P '^v\d+\.\d+\.\d+$' tags | sort -rV | head -n1)"
43-
echo "STABLE_TAG=${STABLE_TAG:-v0.0.0}" >> $GITHUB_ENV
48+
echo "stable_tag=${STABLE_TAG:-v0.0.0}" >> $GITHUB_ENV
4449
LATEST_TAG="$(grep -P '^v\d+\.\d+\.\d+' tags | sort -rV | head -n1)"
45-
echo "LATEST_TAG=${LATEST_TAG:-v0.0.0}" >> $GITHUB_ENV
50+
echo "latest_tag=${LATEST_TAG:-v0.0.0}" >> $GITHUB_ENV
4651
- name: Update latest and stable tags
4752
run: |
4853
skopeo copy docker://${{ github.repository }}:${{ env.stable_tag }} docker://${{ github.repository }}:stable

0 commit comments

Comments
 (0)