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
23- - uses : docker/build-push-action@v5 # Using v5 for latest features
29+ - uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
2430 with :
2531 context : ./src/xcp_ng_dev/
2632 file : ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -35,18 +41,23 @@ jobs:
3541
3642 xcp-ng-build-env-83 :
3743 runs-on : ubuntu-latest
44+ permissions :
45+ packages : write # Required to push packages to GHCR
3846 steps :
3947 - uses : actions/checkout@v4
40- - uses : docker/setup-buildx-action@v3
48+ with :
49+ persist-credentials : false
50+ - uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
4151 with :
4252 driver : docker-container
43- - uses : docker/login-action@v3
53+ - uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
4454 if : github.ref == 'refs/heads/master'
4555 with :
4656 registry : ghcr.io
4757 username : ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
4858 password : ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
49- - uses : docker/build-push-action@v5 # Using v5 for latest features
59+ - run : echo "VERSION=$(cat ./src/xcp_ng_dev/files/protocol-version.txt | tr -d '\n')" >> $GITHUB_ENV
60+ - uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
5061 with :
5162 context : ./src/xcp_ng_dev/
5263 file : ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -60,18 +71,22 @@ jobs:
6071 # TODO: uncomment once we have a public xcp-ng 9.0 repository
6172 # xcp-ng-build-env-90:
6273 # runs-on: ubuntu-latest
74+ # permissions:
75+ # packages: write # Required to push packages to GHCR
6376 # steps:
6477 # - uses: actions/checkout@v4
65- # - uses: docker/setup-buildx-action@v3
78+ # with:
79+ # persist-credentials: false
80+ # - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
6681 # with:
6782 # driver: docker-container
68- # - uses: docker/login-action@v3
83+ # - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
6984 # if: github.ref == 'refs/heads/master'
7085 # with:
7186 # registry: ghcr.io
7287 # username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
7388 # password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
74- # - uses: docker/build-push-action@v5 # Using v5 for latest features
89+ # - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
7590 # with:
7691 # context: ./src/xcp_ng_dev/
7792 # file: ./src/xcp_ng_dev/files/Dockerfile-9.x
0 commit comments