From 1017010626b436458c05883f079216e3b3eacba9 Mon Sep 17 00:00:00 2001 From: alrevuelta Date: Thu, 1 Sep 2022 00:21:24 +0200 Subject: [PATCH] Add action to push to docker on each new release --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..89d1af3f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release +on: + push: + tags: + - 'v*' +jobs: + deploy: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags') + steps: + - name: Extract Version + id: version_step + run: | + echo "##[set-output name=version;]VERSION=${GITHUB_REF#$"refs/tags/v"}" + echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}" + echo "##[set-output name=latest_tag;]$GITHUB_REPOSITORY:latest" + - name: Print Version + run: | + echo ${{steps.version_step.outputs.version_tag}} + echo ${{steps.version_step.outputs.latest_tag}} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: PrepareReg Names + id: read-docker-image-identifiers + run: | + echo VERSION_TAG=$(echo ${{ steps.version_step.outputs.version_tag }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + echo LASTEST_TAG=$(echo ${{ steps.version_step.outputs.latest_tag }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: | + ${{env.VERSION_TAG}} + ${{env.LASTEST_TAG}} + build-args: | + ${{steps.version_step.outputs.version}}