From d73493a624eb09b593bdd0181baf304d7edc0c94 Mon Sep 17 00:00:00 2001 From: MengYX Date: Mon, 8 Feb 2021 17:12:27 +0800 Subject: [PATCH] Fix: [CI] Build Docker Image --- .github/workflows/release-docker.yml | 87 +++++++++++++++++++--------- .github/workflows/release.yml | 6 -- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index d83c35b..1872623 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -1,30 +1,65 @@ -name: Publish Docker image +name: Publish Docker Image on: release: types: [ published ] jobs: - - name: Download release content - run: | - wget -o modern.tar.gz "https://github.com/ix64/unlock-music/releases/download/${{ GITHUB_REF }}/modern.tar.gz" - mkdir ./dist - tar zxvf modern.tar.gz -C ./dist - - - 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 docker and push (on modern) - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/386 - push: true - tags: | - ix64/unlock-music:latest - ix64/unlock-music:${{ GITHUB_REF }} + release-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup vars + id: vars + env: + RELEASE_REF: ${{ github.ref }} + run: echo "::set-output name=tag::${RELEASE_REF#refs/tags/}" + + - name: Download release content + run: | + echo "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" + wget -O modern.tar.gz "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" + mkdir ./dist + tar zxf modern.tar.gz -C ./dist + + - 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 docker and push (on modern) + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/386 + push: true + tags: | + ix64/unlock-music:latest + ix64/unlock-music:${{ steps.vars.outputs.tag }} + + gh-pages: + runs-on: ubuntu-latest + steps: + - name: Setup vars + id: vars + env: + RELEASE_REF: ${{ github.ref }} + run: echo "::set-output name=tag::${RELEASE_REF#refs/tags/}" + + - name: Download release content + run: | + echo "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" + wget -O modern.tar.gz "https://github.com/${{ github.repository }}/releases/download/${{ steps.vars.outputs.tag }}/modern.tar.gz" + mkdir ./dist + tar zxf modern.tar.gz -C ./dist + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5e0f2c..05b324e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,12 +53,6 @@ jobs: - name: Checksum run: sha256sum *.tar.gz *.zip > sha256sum.txt - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist - - name: Get current time id: date run: echo "::set-output name=date::$(date +'%Y/%m/%d')"