diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 24b83bb..ec0b98e 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -6,11 +6,6 @@ on: - 'README.md' - 'config/**' - 'docs/**' - pull_request: - paths-ignore: - - 'README.md' - - 'config/**' - - 'docs/**' jobs: build: @@ -83,4 +78,4 @@ jobs: push: true tags: | ghcr.io/cquptmirror/worker:${{ matrix.worker }} - cquptmirror/worker:${{ matrix.worker }} + cquptmirror/worker:${{ matrix.worker }} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c7603f3 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,73 @@ +name: Build and Push Docker Images + +on: + pull_request: + paths-ignore: + - 'README.md' + - 'config/**' + - 'docs/**' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + target: [ controller, manager, worker ] + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Github Packages + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/cquptmirror/${{ matrix.target }} + - name: Build and Push ${{ matrix.target }} image + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile.${{ matrix.target }} + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + build-worker: + runs-on: ubuntu-latest + strategy: + matrix: + worker: [ anaconda, bandersnatch, entware, git, github-release ] + needs: build + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Github Packages + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/cquptmirror/worker-${{ matrix.target }} + - name: Build and Push ${{ matrix.worker }} worker image + uses: docker/build-push-action@v5 + with: + context: docker/worker/${{ matrix.worker }} + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file