diff --git a/.github/workflows/openssl3.yml b/.github/workflows/openssl3.yml index 91986d0..5fa4d1b 100644 --- a/.github/workflows/openssl3.yml +++ b/.github/workflows/openssl3.yml @@ -38,17 +38,17 @@ env: jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - platform: - - linux/amd64 - - linux/arm64 + include: + - arch: arm64 + runner: oqs-arm64 + - arch: x86_64 + runner: ubuntu-latest + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 if: env.push == 'true' with: @@ -65,7 +65,6 @@ jobs: with: load: true context: openssl3 - platforms: ${{ matrix.platform }} build-args: | MAKE_DEFINES=-j4 ${{ (inputs.build_main == 'true') && env.build-args || null }} @@ -82,10 +81,19 @@ jobs: with: push: true context: openssl3 - platforms: ${{ matrix.platform }} build-args: | MAKE_DEFINES=-j4 ${{ (inputs.build_main == 'true') && env.build-args || null }} tags: | - ghcr.io/${{ github.repository_owner }}/openssl3:${{ inputs.release_tag || 'latest' }} - openquantumsafe/openssl3:${{ inputs.release_tag || 'latest' }} + ghcr.io/${{ github.repository_owner }}/openssl3:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} + openquantumsafe/openssl3:${{ inputs.release_tag || 'latest' }}-${{ matrix.arch }} + + push: + needs: build + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/manifest + if: env.push == 'true' + with: + image_name: openssl3 + release_tag: ${{ inputs.release_tag || 'latest' }} diff --git a/.github/workflows/push-manifest.yml b/.github/workflows/push-manifest.yml new file mode 100644 index 0000000..a1a12d5 --- /dev/null +++ b/.github/workflows/push-manifest.yml @@ -0,0 +1,41 @@ +name: push-manifest + +on: + workflow_call: + inputs: + image_name: + description: "Which docker image to push to" + required: true + type: string + release_tag: + description: "Which docker tag to push to" + required: false + type: string + +jobs: + push: + runs-on: ubuntu-latest + steps: + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push multiarch image to ghcr.io + run: | + docker manifest create ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} \ + --amend ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-x86_64 \ + --amend ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-arm64 && + docker manifest push ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} + + - name: Push multiarch image to DockerHub + run: | + docker manifest create openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }} \ + --amend openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-x86_64 \ + --amend openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}-arm64 && + docker manifest push openquantumsafe/${{ inputs.image_name }}:${{ inputs.release_tag || 'latest' }}