From 173080ab3fb35c6d1cdf2b3dc8f55bbe7074662d Mon Sep 17 00:00:00 2001 From: Jachen Duschletta Date: Tue, 30 Jul 2024 16:00:10 -0500 Subject: [PATCH 1/2] Create build_push.yml --- .github/workflows/build_push.yml | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/build_push.yml diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml new file mode 100644 index 0000000..62287ae --- /dev/null +++ b/.github/workflows/build_push.yml @@ -0,0 +1,80 @@ +name: 'Build and push container (GHCR / Dockerhub)' + +on: + release: + types: [published] + workflow_dispatch: + inputs: + TAG_NAME: + description: 'Release Version Tag (0.0.0)' + required: true +jobs: + node: + name: 'Build & Publish Container' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + ref: ${{ github.ref }} + - name: Update Package to Release version + uses: technote-space/package-version-check-action@v1.9.3 + - name: Check Docker secret presence + id: checkdocker + shell: bash + run: | + if [ "$SECRET" == "" ]; then + echo "secretspresent=false" >> $GITHUB_OUTPUT + else + echo "secretspresent=true" >> $GITHUB_OUTPUT + fi + env: + SECRET: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker QEMU + if: ${{ steps.checkdocker.outputs.secretspresent }} + uses: docker/setup-qemu-action@v3.0.0 + with: + platforms: amd64, arm64 + - name: Set up Docker Buildx + if: ${{ steps.checkdocker.outputs.secretspresent }} + uses: docker/setup-buildx-action@v3.0.0 + + - name: Login to DockerHub + if: ${{ steps.checkdocker.outputs.secretspresent }} + uses: docker/login-action@v3.0.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push to Docker Hub + if: ${{ steps.checkdocker.outputs.secretspresent }} + uses: docker/build-push-action@v5.0.0 + with: + platforms: linux/amd64, linux/arm64 + push: true + tags: | + qxip/speech2hep:latest + qxip/speech2hep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} + qxip/speech2hep:latest + qxip/speech2hep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} + labels: | + dev.speech2hep.image.title=speech2hep + dev.speech2hep.image.type=nodejs + dev.speech2hep.image.version={{github.event.inputs.TAG_NAME || github.event.release.tag_name }} + - name: Log in to the GHCR registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push to GHCR + uses: docker/build-push-action@v5.0.0 + with: + platforms: linux/amd64, linux/arm64 + file: ./Dockerfile + push: true + tags: | + ghcr.io/qxip/speech2hep:latest + ghcr.io/qxip/speech2hep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} + labels: | + dev.speech2hep.image.title=speech2hep + dev.speech2hep.image.type=nodejs + dev.speech2hep.image.version={{github.event.inputs.TAG_NAME || github.event.release.tag_name }} From 2d68d18908cf71ee11ac9d16f1fb2af15bdf2cbe Mon Sep 17 00:00:00 2001 From: dletta Date: Wed, 31 Jul 2024 10:02:42 -0500 Subject: [PATCH 2/2] Simple GHCR Push action --- .github/workflows/build_push.yml | 50 ++------------------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 62287ae..86770f6 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -18,57 +18,11 @@ jobs: ref: ${{ github.ref }} - name: Update Package to Release version uses: technote-space/package-version-check-action@v1.9.3 - - name: Check Docker secret presence - id: checkdocker - shell: bash - run: | - if [ "$SECRET" == "" ]; then - echo "secretspresent=false" >> $GITHUB_OUTPUT - else - echo "secretspresent=true" >> $GITHUB_OUTPUT - fi - env: - SECRET: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up Docker QEMU - if: ${{ steps.checkdocker.outputs.secretspresent }} - uses: docker/setup-qemu-action@v3.0.0 - with: - platforms: amd64, arm64 - - name: Set up Docker Buildx - if: ${{ steps.checkdocker.outputs.secretspresent }} - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to DockerHub - if: ${{ steps.checkdocker.outputs.secretspresent }} - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push to Docker Hub - if: ${{ steps.checkdocker.outputs.secretspresent }} - uses: docker/build-push-action@v5.0.0 - with: - platforms: linux/amd64, linux/arm64 - push: true - tags: | - qxip/speech2hep:latest - qxip/speech2hep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} - qxip/speech2hep:latest - qxip/speech2hep:${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} - labels: | - dev.speech2hep.image.title=speech2hep - dev.speech2hep.image.type=nodejs - dev.speech2hep.image.version={{github.event.inputs.TAG_NAME || github.event.release.tag_name }} - - name: Log in to the GHCR registry - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push to GHCR uses: docker/build-push-action@v5.0.0 with: - platforms: linux/amd64, linux/arm64 + platforms: linux/amd64 file: ./Dockerfile push: true tags: |