|
| 1 | +name: Build and Push cuos-installer-factory (Multi-Arch) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - development |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + paths: |
| 11 | + - installer-factory/** |
| 12 | + - .github/workflows/docker-installer-factory.yml |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-and-push: |
| 17 | + if: github.event_name != 'pull_request' |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + packages: write |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v5 |
| 25 | + |
| 26 | + - name: Set up QEMU |
| 27 | + uses: docker/setup-qemu-action@v3 |
| 28 | + |
| 29 | + - name: Set up Docker Buildx |
| 30 | + uses: docker/setup-buildx-action@v3 |
| 31 | + |
| 32 | + - name: Login to GitHub Container Registry |
| 33 | + uses: docker/login-action@v3 |
| 34 | + with: |
| 35 | + registry: ghcr.io |
| 36 | + username: ${{ github.actor }} |
| 37 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + |
| 39 | + - name: Set image tag |
| 40 | + id: vars |
| 41 | + run: | |
| 42 | + if [[ "$GITHUB_REF" == refs/tags/* ]]; then |
| 43 | + TAG=${GITHUB_REF#refs/tags/} |
| 44 | + elif [[ "$GITHUB_REF" == "refs/heads/main" ]]; then |
| 45 | + TAG=latest |
| 46 | + else |
| 47 | + TAG=${GITHUB_REF#refs/heads/} |
| 48 | + TAG=${TAG//\//-} |
| 49 | + fi |
| 50 | + echo "tag=$TAG" >> $GITHUB_OUTPUT |
| 51 | +
|
| 52 | + - name: Build and push Docker image - cuos-installer-factory |
| 53 | + uses: docker/build-push-action@v6 |
| 54 | + with: |
| 55 | + context: ./ |
| 56 | + file: ./installer-factory/Dockerfile |
| 57 | + push: true |
| 58 | + tags: | |
| 59 | + ghcr.io/${{ github.repository_owner }}/cuos-installer-factory:${{ steps.vars.outputs.tag }} |
| 60 | + labels: | |
| 61 | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} |
| 62 | + org.opencontainers.image.revision=${{ github.sha }} |
| 63 | + org.opencontainers.image.created=${{ github.run_id }} |
| 64 | + org.opencontainers.image.version=${{ steps.vars.outputs.tag }} |
| 65 | + #platforms: linux/amd64,linux/arm64,linux/arm/v7 |
| 66 | + cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cuos-installer-factory:buildcache |
| 67 | + cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cuos-installer-factory:buildcache,mode=max |
0 commit comments