feat(ci): 支持通过 repository variable 控制 SIMPLE_RELEASE

This commit is contained in:
song
2026-01-04 09:53:46 +08:00
parent e91fba82a8
commit 44785a9a8c

View File

@@ -16,6 +16,11 @@ on:
type: boolean type: boolean
default: false default: false
# 环境变量:合并 workflow_dispatch 输入和 repository variable
# tag push 触发时读取 vars.SIMPLE_RELEASEworkflow_dispatch 时使用输入参数
env:
SIMPLE_RELEASE: ${{ github.event.inputs.simple_release == 'true' || vars.SIMPLE_RELEASE == 'true' }}
permissions: permissions:
contents: write contents: write
packages: write packages: write
@@ -161,7 +166,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6 uses: goreleaser/goreleaser-action@v6
with: with:
version: '~> v2' version: '~> v2'
args: release --clean --skip=validate ${{ github.event.inputs.simple_release == 'true' && '--config=.goreleaser.simple.yaml' || '' }} args: release --clean --skip=validate ${{ env.SIMPLE_RELEASE == 'true' && '--config=.goreleaser.simple.yaml' || '' }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_MESSAGE: ${{ steps.tag_message.outputs.message }} TAG_MESSAGE: ${{ steps.tag_message.outputs.message }}
@@ -172,7 +177,7 @@ jobs:
# Update DockerHub description # Update DockerHub description
- name: Update DockerHub description - name: Update DockerHub description
if: ${{ github.event.inputs.simple_release != 'true' && env.DOCKERHUB_USERNAME != '' }} if: ${{ env.SIMPLE_RELEASE != 'true' && env.DOCKERHUB_USERNAME != '' }}
uses: peter-evans/dockerhub-description@v4 uses: peter-evans/dockerhub-description@v4
env: env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -185,7 +190,7 @@ jobs:
# Send Telegram notification # Send Telegram notification
- name: Send Telegram Notification - name: Send Telegram Notification
if: ${{ github.event.inputs.simple_release != 'true' }} if: ${{ env.SIMPLE_RELEASE != 'true' }}
env: env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}