diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..7593f33 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,55 @@ +name: Build Docker +on: + push: + tags: + - 'v*.*.*' + +jobs: + docker: + name: Build docker + runs-on: ubuntu-latest + steps: + - name: Get Release Version + run: | + export RELEASE_VERSION=${GITHUB_REF#refs/*/} + echo RELEASE_VERSION: ${RELEASE_VERSION} + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV + + - name: Check out code + uses: actions/checkout@v3 + + - name: Create Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: | + yedf/dtm + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - 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: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./helper/Dockerfile-release + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + RELEASE_VERSION=${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2edc31e..558f80f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,39 +60,3 @@ jobs: rm deploy_key dist.tar.gz echo > dist/placeholder cd .. - - - name: Create Docker - id: meta - uses: docker/metadata-action@v3 - with: - images: | - yedf/dtm - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - - 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: Build and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./helper/Dockerfile-release - push: true - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - RELEASE_VERSION=${{ env.RELEASE_VERSION }}