diff --git a/.github/actions/build-image.yml b/.github/actions/build-image.yml deleted file mode 100644 index 265963b..0000000 --- a/.github/actions/build-image.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build Image - -on: - workflow_call: - inputs: - tags: - description: "Docker image tags" - required: true - secrets: - GITHUB_TOKEN: - required: true - -jobs: - build-image: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download binaries - uses: actions/download-artifact@v4 - with: - path: . - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/sergi0g/cup - tags: ${{ inputs.tags }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: sergi0g - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml new file mode 100644 index 0000000..a1f04df --- /dev/null +++ b/.github/actions/build-image/action.yml @@ -0,0 +1,51 @@ +name: Build Image +inputs: + tags: + description: "Docker image tags" + required: true + secrets: + GITHUB_TOKEN: + required: true + +runs: + using: 'composite' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download binaries + uses: actions/download-artifact@v4 + with: + path: . + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/sergi0g/cup + tags: ${{ inputs.tags }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: sergi0g + password: $GITHUB_TOKEN + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c59f77a..fd0c506 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -65,11 +65,14 @@ jobs: needs: - get-tag - build-binaries - uses: ./.github/actions/build-image.yml - with: - tags: ${{ needs.get-tag.outputs.tag }} - secrets: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-latest + steps: + - uses: ./.github/actions/build-image + with: + tags: | + ${{ needs.get-tag.outputs.tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} nightly-release: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1721419..b0ccbc3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,13 +63,15 @@ jobs: needs: - get-tag - build-binaries - uses: ./.github/actions/build-image.yml - with: - tags: | - ${{ needs.get-tag.outputs.tag }} - latest - secrets: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-latest + steps: + - uses: ./.github/actions/build-image + with: + tags: | + ${{ needs.get-tag.outputs.tag }} + latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} release: runs-on: ubuntu-latest @@ -89,4 +91,4 @@ jobs: prerelease: true tag_name: ${{ needs.get-tag.outputs.tag }} name: ${{ needs.get-tag.outputs.tag }} - files: binaries/* \ No newline at end of file + files: binaries/*