11name : Build and Push Docker Image to GHCR
22
3- on : push
3+ on :
4+ push :
5+ branches :
6+ - ' master'
7+ pull_request :
48
5- permissions :
6- contents : read # Required to checkout the repo code
7- packages : write # Required to push packages to GHCR
9+ permissions : {}
810
911jobs :
1012 xcp-ng-build-env-82 :
1113 runs-on : ubuntu-latest
14+ permissions :
15+ packages : write # Required to push packages to GHCR
1216 steps :
1317 - uses : actions/checkout@v4
14- - uses : docker/setup-buildx-action@v3
18+ with :
19+ persist-credentials : false
20+ - uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
1521 with :
1622 driver : docker-container
17- - uses : docker/login-action@v3
23+ - uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
1824 if : github.ref == 'refs/heads/master'
1925 with :
2026 registry : ghcr.io
2127 username : ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
2228 password : ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
2329 - run : echo "VERSION=$(cat ./src/xcp_ng_dev/files/version.txt | tr -d '\n')" >> $GITHUB_ENV
24- - uses : docker/build-push-action@v5 # Using v5 for latest features
30+ - uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
2531 with :
2632 context : ./src/xcp_ng_dev/
2733 file : ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -36,19 +42,23 @@ jobs:
3642
3743 xcp-ng-build-env-83 :
3844 runs-on : ubuntu-latest
45+ permissions :
46+ packages : write # Required to push packages to GHCR
3947 steps :
4048 - uses : actions/checkout@v4
41- - uses : docker/setup-buildx-action@v3
49+ with :
50+ persist-credentials : false
51+ - uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
4252 with :
4353 driver : docker-container
44- - uses : docker/login-action@v3
54+ - uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
4555 if : github.ref == 'refs/heads/master'
4656 with :
4757 registry : ghcr.io
4858 username : ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
4959 password : ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
5060 - run : echo "VERSION=$(cat ./src/xcp_ng_dev/files/version.txt | tr -d '\n')" >> $GITHUB_ENV
51- - uses : docker/build-push-action@v5 # Using v5 for latest features
61+ - uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
5262 with :
5363 context : ./src/xcp_ng_dev/
5464 file : ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -62,19 +72,23 @@ jobs:
6272 # TODO: uncomment once we have a public xcp-ng 9.0 repository
6373 # xcp-ng-build-env-90:
6474 # runs-on: ubuntu-latest
75+ # permissions:
76+ # packages: write # Required to push packages to GHCR
6577 # steps:
6678 # - uses: actions/checkout@v4
67- # - uses: docker/setup-buildx-action@v3
79+ # with:
80+ # persist-credentials: false
81+ # - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
6882 # with:
6983 # driver: docker-container
70- # - uses: docker/login-action@v3
84+ # - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
7185 # if: github.ref == 'refs/heads/master'
7286 # with:
7387 # registry: ghcr.io
7488 # username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
7589 # password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
7690 # - run: echo "VERSION=$(cat ./src/xcp_ng_dev/files/version.txt | tr -d '\n')" >> $GITHUB_ENV
77- # - uses: docker/build-push-action@v5 # Using v5 for latest features
91+ # - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
7892 # with:
7993 # context: ./src/xcp_ng_dev/
8094 # file: ./src/xcp_ng_dev/files/Dockerfile-9.x
0 commit comments