This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
Cleanup releases with invalid multiarch images #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker builds - manual and tagged | |
on: | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: "Image Tag value" | |
type: "string" | |
required: true | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+-?[a-zA-Z]*' | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '!bwsm-eso-provider-*' | |
paths: | |
- src/** | |
jobs: | |
docker-image-build: | |
environment: 'dockerhub' | |
env: | |
DOCKER_IMAGE_NAME: bojanraic/bwsm-eso | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Dockerhub Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ env.DOCKERHUB_PAT }} | |
- name: QEMU Setup | |
uses: docker/setup-qemu-action@v3 | |
- name: Docker Buildx Setup | |
uses: docker/setup-buildx-action@v3 | |
- name: Manual Build/Push - amd64 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: src | |
push: true | |
provenance: false | |
platforms: linux/amd64 | |
build-args: | | |
BWS_DL_ARCH=x86_64 | |
tags: | | |
${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.image_tag }}-amd64 | |
- name: Manual Build/Push - arm64 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: src | |
push: true | |
provenance: false | |
platforms: linux/arm64 | |
build-args: | | |
BWS_DL_ARCH=aarch64 | |
tags: | | |
${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.image_tag }}-arm64 | |
- name: Push Multiplatform Manual Image Manifest | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.DOCKER_IMAGE_NAME }}:latest, ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.image_tag }} | |
images: ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.image_tag }}-amd64, ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.image_tag }}-arm64 | |
push: true | |
- name: Cleanup Internediate Manual Platform-Specific Images | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
REPO=${{ env.DOCKER_IMAGE_NAME }} | |
DH_USER=${{ env.DOCKERHUB_USERNAME }} | |
DH_PASS=${{ env.DOCKERHUB_PAT }} | |
JWT=$(curl -s -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{\"username\":\"${DH_USER}\",\"password\":\"${DH_PASS}\"}" -L 'https://hub.docker.com/v2/users/login' | jq -r '.token') | |
TAG=${{ inputs.image_tag }}-arm64 | |
curl -s "https://hub.docker.com/v2/repositories/${REPO}/tags/${TAG}/" -X DELETE -H "Authorization: JWT ${JWT}" | |
TAG=${{ inputs.image_tag }}-amd64 | |
curl -s "https://hub.docker.com/v2/repositories/${REPO}/tags/${TAG}/" -X DELETE -H "Authorization: JWT ${JWT}" | |
- name: Tagged Build/Push - amd64 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: src | |
push: true | |
provenance: false | |
platforms: linux/amd64 | |
build-args: | | |
BWS_DL_ARCH=x86_64 | |
tags: | | |
bojanraic/bwsm-eso:${{ github.ref_name }}-amd64 | |
- name: Tagged Build/Push - arm64 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: src | |
push: true | |
provenance: false | |
platforms: linux/arm64 | |
build-args: | | |
BWS_DL_ARCH=aarch64 | |
tags: | | |
bojanraic/bwsm-eso:${{ github.ref_name }}-arm64 | |
- name: Tagged Release | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true | |
name: v${{ github.ref_name }} | |
- name: Push Multiplatform Tagged Image Manifest | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.DOCKER_IMAGE_NAME }}:latest, ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }} | |
images: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}-amd64, ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}-arm64 | |
push: true | |
- name: Cleanup Internediate Tagged Platform-Specific Images | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
REPO=${{ env.DOCKER_IMAGE_NAME }} | |
DH_USER=${{ env.DOCKERHUB_USERNAME }} | |
DH_PASS=${{ env.DOCKERHUB_PAT }} | |
JWT=$(curl -s -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{\"username\":\"${DH_USER}\",\"password\":\"${DH_PASS}\"}" -L 'https://hub.docker.com/v2/users/login' | jq -r '.token') | |
TAG=${{ github.ref_name }}-amd64 | |
curl -s "https://hub.docker.com/v2/repositories/${REPO}/tags/${TAG}/" -X DELETE -H "Authorization: JWT ${JWT}" | |
TAG=${{ github.ref_name }}-arm64 | |
curl -s "https://hub.docker.com/v2/repositories/${REPO}/tags/${TAG}/" -X DELETE -H "Authorization: JWT ${JWT}" |