Browse Source

Fix: [CI] Build Docker Image

20230320
MengYX 4 years ago
parent
commit
d73493a624
No known key found for this signature in database GPG Key ID: E63F9C7303E8F604
  1. 87
      .github/workflows/release-docker.yml
  2. 6
      .github/workflows/release.yml

87
.github/workflows/release-docker.yml

@ -1,30 +1,65 @@
name: Publish Docker image name: Publish Docker Image
on: on:
release: release:
types: [ published ] types: [ published ]
jobs: jobs:
- name: Download release content release-docker:
run: | runs-on: ubuntu-latest
wget -o modern.tar.gz "https://github.com/ix64/unlock-music/releases/download/${{ GITHUB_REF }}/modern.tar.gz" steps:
mkdir ./dist - uses: actions/checkout@v2
tar zxvf modern.tar.gz -C ./dist
- name: Setup vars
- name: Set up Docker Buildx id: vars
uses: docker/setup-buildx-action@v1 env:
RELEASE_REF: ${{ github.ref }}
- name: Login to DockerHub run: echo "::set-output name=tag::${RELEASE_REF#refs/tags/}"
uses: docker/login-action@v1
with: - name: Download release content
username: ${{ secrets.DOCKERHUB_USERNAME }} run: |
password: ${{ secrets.DOCKERHUB_TOKEN }} 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"
- name: Build docker and push (on modern) mkdir ./dist
uses: docker/build-push-action@v2 tar zxf modern.tar.gz -C ./dist
with:
context: . - name: Set up Docker Buildx
file: ./Dockerfile uses: docker/setup-buildx-action@v1
platforms: linux/amd64,linux/arm64,linux/386
push: true - name: Login to DockerHub
tags: | uses: docker/login-action@v1
ix64/unlock-music:latest with:
ix64/unlock-music:${{ GITHUB_REF }} 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

6
.github/workflows/release.yml

@ -53,12 +53,6 @@ jobs:
- name: Checksum - name: Checksum
run: sha256sum *.tar.gz *.zip > sha256sum.txt 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 - name: Get current time
id: date id: date
run: echo "::set-output name=date::$(date +'%Y/%m/%d')" run: echo "::set-output name=date::$(date +'%Y/%m/%d')"

Loading…
Cancel
Save