From 2ad27046fb7ffa25b7f8083064a64c80f0d46a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=87=89?= Date: Thu, 20 Jan 2022 20:30:58 +0800 Subject: [PATCH] :art: split build and docker --- .github/workflows/build.yml | 39 +---------------------- .github/workflows/docker_build.yml | 46 ++++++++++++++++++++++++++++ .github/workflows/docker_release.yml | 45 +++++++++++++++++++++++++++ .github/workflows/release.yml | 39 +---------------------- 4 files changed, 93 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/docker_build.yml create mode 100644 .github/workflows/docker_release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58eba767..8d2079fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,41 +48,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: artifact - path: alist/build - docker: - name: Docker - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: xhofe/alist - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: '16' - - name: Build web - run: | - bash build.sh web - mv dist/* public - - 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: xhofe - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x \ No newline at end of file + path: alist/build \ No newline at end of file diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 00000000..8ddf8356 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,46 @@ +name: build + +on: + push: + branches: [ v2 ] + pull_request: + branches: [ v2 ] + +jobs: + docker_build: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: xhofe/alist + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Build web + run: | + bash build.sh web + mv dist/* public + - 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: xhofe + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x \ No newline at end of file diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml new file mode 100644 index 00000000..9507a30b --- /dev/null +++ b/.github/workflows/docker_release.yml @@ -0,0 +1,45 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + docker_release: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: xhofe/alist + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Build web + run: | + bash build.sh cdn + mv dist/* public + - 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: xhofe + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5acf2a3..65b834d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,41 +43,4 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - files: alist/build/compress/* - docker: - name: Docker - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: xhofe/alist - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: '16' - - name: Build web - run: | - bash build.sh cdn - mv dist/* public - - 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: xhofe - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x \ No newline at end of file + files: alist/build/compress/* \ No newline at end of file