|
| 1 | +--- |
| 2 | +name: 📦 Build and Publish |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'main' |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + setup-matrix: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }} |
| 20 | + tag_matrix: ${{ steps.set-tag-matrix.outputs.tag_matrix }} |
| 21 | + steps: |
| 22 | + - name: Source checkout |
| 23 | + uses: actions/checkout@v6 |
| 24 | + |
| 25 | + - name: 'Setup yq' |
| 26 | + |
| 27 | + |
| 28 | + - id: set-build-matrix |
| 29 | + run: echo "build_matrix=$(bash matrix.sh build)" >> $GITHUB_OUTPUT |
| 30 | + |
| 31 | + - id: set-tag-matrix |
| 32 | + run: echo "tag_matrix=$(bash matrix.sh tag)" >> $GITHUB_OUTPUT |
| 33 | + |
| 34 | + build-and-push-container: |
| 35 | + runs-on: ${{ matrix.runner }} |
| 36 | + permissions: |
| 37 | + contents: read |
| 38 | + packages: write |
| 39 | + needs: setup-matrix |
| 40 | + strategy: |
| 41 | + matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }} |
| 42 | + steps: |
| 43 | + - name: Build Vox Pupuli OpenBolt Container v${{ matrix.rubygem_openbolt }}-${{ matrix.platform }} |
| 44 | + uses: voxpupuli/gha-build-and-publish-a-container@v2 |
| 45 | + with: |
| 46 | + registry_password: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + build_args: | |
| 48 | + BASE_IMAGE=${{ matrix.base_image }} |
| 49 | + RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }} |
| 50 | + RUBYGEM_OPENBOLT=${{ matrix.rubygem_openbolt }} |
| 51 | + build_arch: linux/${{ matrix.platform }} |
| 52 | + buildfile: Containerfile |
| 53 | + docker_username: voxpupulibot |
| 54 | + docker_password: ${{ secrets.DOCKERHUB_BOT_ADMIN_TOKEN }} |
| 55 | + tags: | |
| 56 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-${{ matrix.platform }} |
| 57 | +
|
| 58 | + create-multiarch-manifests: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + permissions: |
| 61 | + contents: read |
| 62 | + packages: write |
| 63 | + needs: |
| 64 | + - setup-matrix |
| 65 | + - build-and-push-container |
| 66 | + strategy: |
| 67 | + matrix: ${{ fromJson(needs.setup-matrix.outputs.tag_matrix) }} |
| 68 | + steps: |
| 69 | + - name: Log in to the ghcr.io registry |
| 70 | + uses: docker/login-action@v3 |
| 71 | + with: |
| 72 | + registry: ghcr.io |
| 73 | + username: ${{ github.repository_owner }} |
| 74 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + |
| 76 | + - name: Log in to the docker.io registry |
| 77 | + uses: docker/login-action@v3 |
| 78 | + with: |
| 79 | + registry: docker.io |
| 80 | + username: voxpupulibot |
| 81 | + password: ${{ secrets.DOCKERHUB_BOT_ADMIN_TOKEN }} |
| 82 | + |
| 83 | + - name: Create multiarch manifests |
| 84 | + run: | |
| 85 | + docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/openbolt:${{ matrix.rubygem_openbolt }}-${{ github.ref_name }} \ |
| 86 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 87 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 88 | +
|
| 89 | + docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/openbolt:${{ matrix.rubygem_openbolt }}-latest \ |
| 90 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 91 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 92 | +
|
| 93 | + docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/openbolt:latest \ |
| 94 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 95 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 96 | +
|
| 97 | + docker buildx imagetools create -t docker.io/${{ github.repository_owner }}/openbolt:${{ matrix.rubygem_openbolt }}-${{ github.ref_name }} \ |
| 98 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 99 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 100 | +
|
| 101 | + docker buildx imagetools create -t docker.io/${{ github.repository_owner }}/openbolt:${{ matrix.rubygem_openbolt }}-latest \ |
| 102 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 103 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 104 | +
|
| 105 | + docker buildx imagetools create -t docker.io/${{ github.repository_owner }}/openbolt:latest \ |
| 106 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-arm64 \ |
| 107 | + ghcr.io/${{ github.repository_owner }}/openbolt:${{ github.sha }}-v${{ matrix.rubygem_openbolt }}-amd64 |
| 108 | +
|
| 109 | + update-dockerhub-description: |
| 110 | + runs-on: ubuntu-latest |
| 111 | + needs: |
| 112 | + - create-multiarch-manifests |
| 113 | + steps: |
| 114 | + - name: Source checkout |
| 115 | + uses: actions/checkout@v6 |
| 116 | + |
| 117 | + - name: Update Docker Hub Description |
| 118 | + uses: peter-evans/dockerhub-description@v5 |
| 119 | + with: |
| 120 | + username: voxpupulibot |
| 121 | + password: ${{ secrets.DOCKERHUB_BOT_ADMIN_TOKEN }} |
| 122 | + repository: voxpupuli/openbolt |
0 commit comments