|
| 1 | +name: Build and Push Docker Image to GHCR |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read # Required to checkout the repo code |
| 10 | + packages: write # Required to push packages to GHCR |
| 11 | + |
| 12 | +jobs: |
| 13 | + xcp-ng-build-env-82: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - uses: docker/setup-buildx-action@v3 |
| 18 | + with: |
| 19 | + driver: docker-container |
| 20 | + - uses: docker/login-action@v3 |
| 21 | + with: |
| 22 | + registry: ghcr.io |
| 23 | + username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow |
| 24 | + password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub |
| 25 | + - uses: docker/build-push-action@v5 # Using v5 for latest features |
| 26 | + with: |
| 27 | + context: . |
| 28 | + file: ./Dockerfile-8.x |
| 29 | + push: true |
| 30 | + tags: ghcr.io/${{ github.repository }}:8.2 |
| 31 | + cache-from: type=gha,scope=${{ github.ref_name }}-82 # Cache layers to speed up builds |
| 32 | + cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-82 # Store layers in cache for future builds |
| 33 | + build-args: | |
| 34 | + XCP_NG_BRANCH=8.2 |
| 35 | +
|
| 36 | + xcp-ng-build-env-83: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: docker/setup-buildx-action@v3 |
| 41 | + with: |
| 42 | + driver: docker-container |
| 43 | + - uses: docker/login-action@v3 |
| 44 | + with: |
| 45 | + registry: ghcr.io |
| 46 | + username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow |
| 47 | + password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub |
| 48 | + - uses: docker/build-push-action@v5 # Using v5 for latest features |
| 49 | + with: |
| 50 | + context: . |
| 51 | + file: ./Dockerfile-8.x |
| 52 | + push: true |
| 53 | + tags: ghcr.io/${{ github.repository }}:8.3 |
| 54 | + cache-from: type=gha,scope=${{ github.ref_name }}-83 # Cache layers to speed up builds |
| 55 | + cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-83 # Store layers in cache for future builds |
| 56 | + |
| 57 | + # TODO: uncomment once we have a public xcp-ng 9.0 repository |
| 58 | + # xcp-ng-build-env-90: |
| 59 | + # runs-on: ubuntu-latest |
| 60 | + # steps: |
| 61 | + # - uses: actions/checkout@v4 |
| 62 | + # - uses: docker/setup-buildx-action@v3 |
| 63 | + # with: |
| 64 | + # driver: docker-container |
| 65 | + # - uses: docker/login-action@v3 |
| 66 | + # with: |
| 67 | + # registry: ghcr.io |
| 68 | + # username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow |
| 69 | + # password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub |
| 70 | + # - uses: docker/build-push-action@v5 # Using v5 for latest features |
| 71 | + # with: |
| 72 | + # context: . |
| 73 | + # file: ./Dockerfile-9.x |
| 74 | + # platforms: | |
| 75 | + # linux/amd64/v2 |
| 76 | + # push: true |
| 77 | + # tags: ghcr.io/${{ github.repository }}:9.0 |
| 78 | + # cache-from: type=gha,scope=${{ github.ref_name }}-90 # Cache layers to speed up builds |
| 79 | + # cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-90 # Store layers in cache for future builds |
0 commit comments