From 00a848f2663ceb1c75b15f3f46bde0c7f83f56b7 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Fri, 27 Dec 2024 02:59:23 -0300 Subject: [PATCH] github: add ghcr.io image build --- .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..44ef976 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release Pipeline + +on: + release: + types: [created] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: WYGIWYH + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v4.1.0 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Update release with changelog + uses: softprops/action-gh-release@v1 + with: + body: ${{ steps.changelog.outputs.changelog }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/prod/django/Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8,linux/arm64/v8