From 7094deb8f598c6bd9c9de4807aa87dd70343a505 Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Mon, 20 Jun 2022 17:07:33 +0200 Subject: [PATCH] Add push dev image workflow file --- .github/workflows/push-dev-image.yml | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/push-dev-image.yml diff --git a/.github/workflows/push-dev-image.yml b/.github/workflows/push-dev-image.yml new file mode 100644 index 00000000..e7f9763e --- /dev/null +++ b/.github/workflows/push-dev-image.yml @@ -0,0 +1,51 @@ +# This workflow can be used to push an image off a branch to Docker Hub. +# This is useful to deploy changes to AB beta or test for testing. +name: Push development image + +on: + workflow_dispatch: + inputs: + pr: + description: 'PR number (if set, ignores above ^)' + required: false + type: string + tag: + description: 'Docker Image Tag (Version)' + required: true + default: 'beta' + +jobs: + + dev: + + runs-on: ubuntu-latest + + steps: + # Run only if we are deploying a branch or tag from this repo + - uses: actions/checkout@v3 + # empty strings evaluate to 0 + if: ${{ github.event.inputs.pr == 0}} + + # Run only if we are deploying a PR (may be in a forked repo) + - uses: actions/checkout@v3 + if: ${{ github.event.inputs.pr != 0}} + with: + ref: ${{ format('refs/pull/{0}/head', github.event.inputs.pr) }} + + + - name: Login to Docker Hub + run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + continue-on-error: true + + - uses: satackey/action-docker-layer-caching@v0.0.11 + continue-on-error: true + + - name: Build development image + run: | + docker build \ + --target acousticbrainz-prod \ + --tag metabrainz/acousticbrainz:"${{ github.event.inputs.tag }}" \ + --build-arg GIT_COMMIT_SHA="${{ github.sha }}" . + + - name: Push development image + run: docker push metabrainz/acousticbrainz:"${{ github.event.inputs.tag }}"