From 1abfabf00c77173d8bd09baded0bbd0345f0025f Mon Sep 17 00:00:00 2001 From: pierreavn Date: Fri, 27 Dec 2024 18:20:20 +0100 Subject: [PATCH] Added DockerHub release workflow --- .github/workflows/build-release-binary.yml | 3 +- .github/workflows/build-release-docker.yml | 52 +++++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-release-binary.yml b/.github/workflows/build-release-binary.yml index 6472813..4d18ff8 100644 --- a/.github/workflows/build-release-binary.yml +++ b/.github/workflows/build-release-binary.yml @@ -3,7 +3,8 @@ name: Build and release binary on: push: tags: - - '*' + - v* + workflow_dispatch: jobs: build-release-binary: diff --git a/.github/workflows/build-release-docker.yml b/.github/workflows/build-release-docker.yml index 86b68ab..41acd3a 100644 --- a/.github/workflows/build-release-docker.yml +++ b/.github/workflows/build-release-docker.yml @@ -1,19 +1,47 @@ -name: Build and Release Docker +name: Build and release Docker on: - schedule: - - cron: "30 1 * * *" + workflow_run: + workflows: ["Build and release binary"] + types: + - completed + workflow_dispatch: jobs: - build-release-docker: - runs-on: ubuntu-latest - + docker: + runs-on: ubuntu-latest-16-cores steps: - - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t verdexlab/verdex . + - name: Checkout repository + uses: actions/checkout@v4 - - name: Push Docker image + - name: Get GitHub tag + id: meta run: | - # TODO + curl --silent "https://api.github.com/repos/verdexlab/verdex/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: verdexlab/verdex:latest,verdexlab/verdex:${{ steps.meta.outputs.TAG }} + + - name: Update DockerHub description + uses: peter-evans/dockerhub-description@v4 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: verdexlab/verdex