From 2b9f74282b83e65c870cb9f16381978c390a08b1 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 10 May 2021 11:29:03 +0200 Subject: ci: Support pushing images with docker/build-push-action@v2 This change updates the publish workflow to support pushing images with the new docker/build-push-action version. --- .github/workflows/publish.yml | 60 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 9 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cabebbd8..bb0f1df6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,38 +11,80 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v2 + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=atlargeresearch/opendc + VERSION=edge + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + TAGS="${DOCKER_IMAGE}:${VERSION}" + echo ::set-output name=tags::${TAGS} + - name: Login to DockerHub + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + push: true repository: atlargeresearch/opendc - tag_with_ref: true + tags: ${{ steps.prep.outputs.tags }} push-api: name: Push API runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v2 + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=atlargeresearch/opendc-web-api + VERSION=edge + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + TAGS="${DOCKER_IMAGE}:${VERSION}" + echo ::set-output name=tags::${TAGS} + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Push to Docker Hub uses: docker/build-push-action@v2 with: + push: true context: opendc-web/opendc-web-api - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} repository: atlargeresearch/opendc-web-api - tag_with_ref: true + tags: ${{ steps.prep.outputs.tags }} push-ui: name: Push UI runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v2 + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=atlargeresearch/opendc-web-ui + VERSION=edge + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + TAGS="${DOCKER_IMAGE}:${VERSION}" + echo ::set-output name=tags::${TAGS} + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Push to Docker Hub uses: docker/build-push-action@v2 with: + push: true context: opendc-web/opendc-web-ui - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} repository: atlargeresearch/opendc-web-ui - tag_with_ref: true + tags: ${{ steps.prep.outputs.tags }} -- cgit v1.2.3