From 76492ad7cb3cabab2a4d6498cb947e53e11b0deb Mon Sep 17 00:00:00 2001 From: damien Date: Thu, 27 Feb 2025 04:28:31 +0000 Subject: [PATCH] Update .github/workflows/release.yaml --- .github/workflows/release.yaml | 46 +++++++++++++--------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index af013bc..aceda4c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,20 +1,17 @@ -name: Build and Push Docker Image +name: Build and Push Docker Image to Gitea Registry on: + push: + branches: [ main ] + paths-ignore: + - '**.md' + pull_request: + branches: [ main ] workflow_dispatch: - inputs: - version: - description: 'Version to tag the image with (e.g., 1.0.0)' - required: true - type: string jobs: build-and-push: runs-on: ubuntu-latest - permissions: - contents: write # Allows tagging and releasing - packages: write - pull-requests: write # Allows reading PR info if needed steps: - name: Checkout repository @@ -37,38 +34,31 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to Container Registry + - name: Login to Gitea Container Registry uses: docker/login-action@v2 with: - registry: ${{ github.server_url }}/${{ github.repository }}/packages - username: ${{ github.actor }} - password: ${{ secrets.PACKAGE_TOKEN }} + registry: git.d4m13n.dev + username: ${{ secrets.GITEA_REGISTRY_USER }} # Store your Gitea registry username as a secret + password: ${{ secrets.GITEA_REGISTRY_TOKEN }} # Store your Gitea registry token/password as a secret - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v4 with: - images: ${{ github.server_url }}/${{ github.repository }}/personal-website + # Full image name including Gitea Registry URL + images: git.d4m13n.dev/damien/personal-website tags: | - type=raw,value=${{ github.event.inputs.version }} + type=ref,event=branch + type=ref,event=pr + type=sha - name: Build and push Docker image uses: docker/build-push-action@v4 with: context: . - push: true - tags: | - ${{ github.server_url }}/${{ github.repository }}/personal-website:latest - ${{ github.server_url }}/${{ github.repository }}/personal-website:${{ github.event.inputs.version }} + push: true # Enable push to registry + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - - name: Create GitHub Release - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - custom_tag: ${{ github.event.inputs.version }} - release_branches: main - create_annotated_tag: true - tag_prefix: v