From 4618b6774ee23bba8387f0fced1b56191f44a236 Mon Sep 17 00:00:00 2001 From: JohnsonRan Date: Tue, 12 Aug 2025 23:07:40 +0800 Subject: [PATCH] fix: missing tag body Signed-off-by: JohnsonRan --- .github/workflows/docker-image.yml | 28 ++++++++++------------------ .github/workflows/release.yml | 7 ++++--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 005c0a2..29c75f7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,7 +5,6 @@ on: workflows: ['Release'] types: - completed - workflow_dispatch: concurrency: @@ -59,11 +58,15 @@ jobs: images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv tags: | type=raw,value=latest,enable={{is_default_branch}} - type=raw,value=${{ env.latest_tag }},enable={{is_default_branch}} + type=raw,value=${{ env.latest_tag }},enable=${{ github.ref == 'refs/heads/main' && github.event_name != 'workflow_run' }} - name: Get latest tag run: | - echo "latest_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/tags | jq -r '.[0].name // "latest"' | sed 's/^v//')" >> $GITHUB_ENV + echo "latest_tag=$( + curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/tags" | \ + jq -r '.[0].name // "latest"' | sed 's/^v//' + )" >> $GITHUB_ENV - name: Build and push by digest id: build @@ -73,7 +76,7 @@ jobs: file: ./Dockerfile platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} - tags: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv:${{ env.latest_tag }} + tags: ${{ github.event_name != 'workflow_run' && format('ghcr.io/{0}/lunatv:{1}', steps.lowercase.outputs.owner, env.latest_tag) || '' }} outputs: type=image,name=ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv,name-canonical=true,push=true - name: Export digest @@ -116,10 +119,6 @@ jobs: id: lowercase run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" - - name: Get latest tag - run: | - echo "latest_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/tags | jq -r '.[0].name // "latest"' | sed 's/^v//')" >> $GITHUB_ENV - - name: Extract metadata id: meta uses: docker/metadata-action@v5 @@ -127,7 +126,7 @@ jobs: images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv tags: | type=raw,value=latest,enable={{is_default_branch}} - type=raw,value=${{ env.latest_tag }},enable={{is_default_branch}} + type=raw,value=${{ env.latest_tag }},enable=${{ github.ref == 'refs/heads/main' && github.event_name != 'workflow_run' }} - name: Create manifest list and push working-directory: /tmp/digests @@ -139,11 +138,10 @@ jobs: run: | docker buildx imagetools inspect ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv:${{ steps.meta.outputs.version }} - cleanup-refresh: + cleanup: runs-on: ubuntu-latest needs: - merge - if: always() && github.event_name != 'pull_request_target' steps: - name: Delete workflow runs uses: Mattraks/delete-workflow-runs@main @@ -151,10 +149,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} retain_days: 0 - keep_minimum_runs: 2 - - name: Refresh VERSION.txt cache - run: | - echo "Refreshing VERSION.txt cache..." - curl -s https://purge.jsdelivr.net/gh/MoonTechLab/LunaTV/VERSION.txt - echo "" - echo "VERSION.txt cache refreshed successfully" + keep_minimum_runs: 4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee08d1b..d4637d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,8 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG_NAME=${{ steps.version.outputs.tag }} - RELEASE_BODY=$(gh release view "$TAG_NAME" --json body -q .body || echo "") + RELEASE_BODY=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME" | jq -r '.body // ""') printf '%s\n' "$RELEASE_BODY" > /tmp/tag_message.txt echo "Tag message saved to /tmp/tag_message.txt" echo "Tag message content:" @@ -83,8 +84,8 @@ jobs: - name: Commit generated files run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" + git config --local user.email "${{ secrets.PUSH_EMAIL }}" + git config --local user.name "${{ secrets.PUSH_NAME }}" git add CHANGELOG VERSION.txt src/lib/changelog.ts src/lib/version.ts if git diff --staged --quiet; then echo "No changes to commit"