diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image-on-push.yml similarity index 67% rename from .github/workflows/docker-image.yml rename to .github/workflows/docker-image-on-push.yml index 397ae29..b4b24e5 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image-on-push.yml @@ -1,4 +1,4 @@ -name: Build and Push Docker Image +name: Build and Push Docker Image On Push on: push: @@ -15,15 +15,22 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v3.1.0 + - name: Docker Login uses: docker/login-action@v3.0.0 with: username: cassius0924 password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - + - name: Build and push Docker image uses: docker/build-push-action@v5.2.0 with: context: . + platforms: linux/amd64,linux/arm64 push: true tags: cassius0924/wechatter:latest diff --git a/.github/workflows/docker-image-on-release.yml b/.github/workflows/docker-image-on-release.yml new file mode 100644 index 0000000..c5f2b60 --- /dev/null +++ b/.github/workflows/docker-image-on-release.yml @@ -0,0 +1,36 @@ +name: Build and Push Docker Image On Release + +on: + release: + types: + - published + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v3.1.0 + + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + username: cassius0924 + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.2.0 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: cassius0924/wechatter:${{ github.event.release.tag_name }}