mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-21 21:57:28 +08:00
28
.github/workflows/docker-image.yml
vendored
28
.github/workflows/docker-image.yml
vendored
@@ -5,7 +5,6 @@ on:
|
|||||||
workflows: ['Release']
|
workflows: ['Release']
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -59,11 +58,15 @@ jobs:
|
|||||||
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv
|
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
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
|
- name: Get latest tag
|
||||||
run: |
|
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
|
- name: Build and push by digest
|
||||||
id: build
|
id: build
|
||||||
@@ -73,7 +76,7 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
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
|
outputs: type=image,name=ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
@@ -116,10 +119,6 @@ jobs:
|
|||||||
id: lowercase
|
id: lowercase
|
||||||
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
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
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@@ -127,7 +126,7 @@ jobs:
|
|||||||
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv
|
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
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
|
- name: Create manifest list and push
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
@@ -139,11 +138,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv:${{ steps.meta.outputs.version }}
|
docker buildx imagetools inspect ghcr.io/${{ steps.lowercase.outputs.owner }}/lunatv:${{ steps.meta.outputs.version }}
|
||||||
|
|
||||||
cleanup-refresh:
|
cleanup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- merge
|
- merge
|
||||||
if: always() && github.event_name != 'pull_request_target'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Delete workflow runs
|
- name: Delete workflow runs
|
||||||
uses: Mattraks/delete-workflow-runs@main
|
uses: Mattraks/delete-workflow-runs@main
|
||||||
@@ -151,10 +149,4 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
retain_days: 0
|
retain_days: 0
|
||||||
keep_minimum_runs: 2
|
keep_minimum_runs: 4
|
||||||
- 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"
|
|
||||||
|
|||||||
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@@ -38,7 +38,8 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG_NAME=${{ steps.version.outputs.tag }}
|
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
|
printf '%s\n' "$RELEASE_BODY" > /tmp/tag_message.txt
|
||||||
echo "Tag message saved to /tmp/tag_message.txt"
|
echo "Tag message saved to /tmp/tag_message.txt"
|
||||||
echo "Tag message content:"
|
echo "Tag message content:"
|
||||||
@@ -83,8 +84,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Commit generated files
|
- name: Commit generated files
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "${{ secrets.PUSH_EMAIL }}"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "${{ secrets.PUSH_NAME }}"
|
||||||
git add CHANGELOG VERSION.txt src/lib/changelog.ts src/lib/version.ts
|
git add CHANGELOG VERSION.txt src/lib/changelog.ts src/lib/version.ts
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
|
|||||||
Reference in New Issue
Block a user