From f0975ee55c4fd353fe5b37a9ac178b4e8496c2c6 Mon Sep 17 00:00:00 2001 From: Stefano Gerli Date: Sat, 11 Dec 2021 17:11:20 +0000 Subject: [PATCH] Add release workflow --- .github/workflows/release.yml | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 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 0000000000..70d8c5287a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Docker Build And Publish + +on: + release: + types: [published] +env: + DOCKER_NAMESPACE: sgerli + DOCKER_REPOSITORY: horario-tec + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ${{ env.DOCKER_NAMESPACE }}/${{ env.DOCKER_REPOSITORY }} + flavor: | + latest=true + tags: | + type=semver,pattern={{version}} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: "./Dockerfile" + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + build-args: | + RELEASE=${{ github.event.release.tag_name }} + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache