From 0be0e36772c1faeaf8bc456a0d453ffc3df3d6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Frederik=20J=C3=B8rgensen?= Date: Tue, 16 Jan 2024 07:55:25 +0100 Subject: [PATCH] ci: Adds Publish image GitHub Actions workflow. It publishes the code with the specified tag via a workflow dispatch. Note that updating the package.json version and tagging the build commit is still done manually. --- .github/workflows/publish-image.yml | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish-image.yml diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml new file mode 100644 index 0000000..88570fe --- /dev/null +++ b/.github/workflows/publish-image.yml @@ -0,0 +1,37 @@ +name: 'Publish image' + +run-name: 'Publish image of {{ github.ref_name }} as {{ inputs.versionTag }}' + +on: + workflow_dispatch: + inputs: + versionTag: + description: 'Version tag (e.g. 1.2.3-staging)' + required: true + type: 'string' + +env: + node-version: '16' + node-package-manager: 'yarn' + +jobs: + publish-image-to-docker-hub: + name: 'Publish image to Docker Hub' + runs-on: 'ubuntu-latest' + steps: + - name: 'Retrieve repository files' + uses: 'actions/checkout@v4' + + - name: 'Log in to Docker Hub' + uses: 'docker/login-action@v3' + with: + username: '${{ secrets.DOCKERHUB_USERNAME }}' + password: '${{ secrets.DOCKERHUB_PASSWORD }}' + + - name: 'Build and publish Docker image' + uses: 'docker/build-push-action@v5' + with: + context: '.' + push: true + tags: | + tv2media/inews-ftp-gateway:${{ inputs.versionTag }}