From b38e0eb6d7ad8e96b8b40c1f58409f0032ecd7dd Mon Sep 17 00:00:00 2001 From: FrancescoL96 <45236222+FrancescoL96@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:13:14 +0200 Subject: [PATCH] feat: updated pipeline (#12) --- .github/workflows/release-pullrequest.yaml | 78 +++++++++++++++++++ .../{release.yaml => release-tag.yaml} | 7 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-pullrequest.yaml rename .github/workflows/{release.yaml => release-tag.yaml} (96%) diff --git a/.github/workflows/release-pullrequest.yaml b/.github/workflows/release-pullrequest.yaml new file mode 100644 index 0000000..9ba559f --- /dev/null +++ b/.github/workflows/release-pullrequest.yaml @@ -0,0 +1,78 @@ +name: release-pullrequest + +on: + pull_request: + branches: + - main + +env: + REGISTRY: ghcr.io + +jobs: + package-amd64: + runs-on: buildjet-2vcpu-ubuntu-2204 + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ github.repository }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to CR + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build docker image and push + id: docker_build_amd64 + uses: docker/build-push-action@v4 + with: + push: false + platforms: linux/amd64 + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true + + package-arm64: + runs-on: buildjet-2vcpu-ubuntu-2204-arm + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ github.repository }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to CR + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build docker image and push + id: docker_build_arm64 + uses: docker/build-push-action@v4 + with: + push: false + platforms: linux/arm64 + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release-tag.yaml similarity index 96% rename from .github/workflows/release.yaml rename to .github/workflows/release-tag.yaml index 00d9041..01d5868 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release-tag.yaml @@ -1,4 +1,4 @@ -name: release +name: release-tag on: push: @@ -106,6 +106,9 @@ jobs: merge: runs-on: buildjet-2vcpu-ubuntu-2204 + permissions: + packages: write + contents: read needs: - package-amd64 - package-arm64 @@ -140,4 +143,4 @@ jobs: - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }} \ No newline at end of file