mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
chore: remove deprecated GitHub Actions workflows for auto-tagging and release
- Deleted the auto-tag.yml and release.yml workflows as they are no longer needed. - This cleanup helps streamline the repository by removing unused configurations and reducing maintenance overhead.
This commit is contained in:
parent
f90d6d7e5f
commit
ff67a07ca7
@ -1,16 +1,21 @@
|
|||||||
name: Auto Tag
|
name: Auto Tag & Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- main
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**.md"
|
- "**.md"
|
||||||
- "LICENSE"
|
- "LICENSE"
|
||||||
- ".gitignore"
|
- ".gitignore"
|
||||||
|
|
||||||
permissions: write-all
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
actions: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pre_job:
|
pre_job:
|
||||||
@ -24,30 +29,49 @@ jobs:
|
|||||||
cancel_others: "true"
|
cancel_others: "true"
|
||||||
concurrent_skipping: "same_content"
|
concurrent_skipping: "same_content"
|
||||||
|
|
||||||
auto-tag:
|
auto-tag-release:
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
if: needs.pre_job.outputs.should_skip != 'true'
|
if: |
|
||||||
|
needs.pre_job.outputs.should_skip != 'true' ||
|
||||||
|
startsWith(github.ref, 'refs/tags/v')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 15
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.get_latest_tag.outputs.version }}
|
version: ${{ steps.get_latest_tag.outputs.version }}
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
lfs: true
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: "1.21"
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
~/.cache/git
|
~/.cache/git
|
||||||
key: ${{ runner.os }}-git-${{ github.sha }}
|
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-git-
|
${{ runner.os }}-build-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
# 只在非tag推送时执行自动打tag
|
||||||
- name: Get latest tag
|
- name: Get latest tag
|
||||||
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
||||||
id: get_latest_tag
|
id: get_latest_tag
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@ -69,6 +93,7 @@ jobs:
|
|||||||
echo "Generated version: $new_version"
|
echo "Generated version: $new_version"
|
||||||
|
|
||||||
- name: Validate version
|
- name: Validate version
|
||||||
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
new_tag="${{ steps.get_latest_tag.outputs.version }}"
|
new_tag="${{ steps.get_latest_tag.outputs.version }}"
|
||||||
@ -87,6 +112,7 @@ jobs:
|
|||||||
echo "Version validation passed"
|
echo "Version validation passed"
|
||||||
|
|
||||||
- name: Create new tag
|
- name: Create new tag
|
||||||
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
@ -96,53 +122,52 @@ jobs:
|
|||||||
git tag -a $new_tag -m "Release $new_tag"
|
git tag -a $new_tag -m "Release $new_tag"
|
||||||
git push origin $new_tag
|
git push origin $new_tag
|
||||||
|
|
||||||
- name: Debug output
|
# Release 相关步骤
|
||||||
run: |
|
- name: Import GPG key
|
||||||
echo "Step outputs:"
|
id: import_gpg
|
||||||
echo " version: ${{ steps.get_latest_tag.outputs.version }}"
|
if: |
|
||||||
echo "Job outputs:"
|
startsWith(github.ref, 'refs/tags/v') ||
|
||||||
echo " all: ${{ toJSON(job.outputs) }}"
|
(success() && steps.get_latest_tag.outputs.version != '')
|
||||||
echo " direct: ${{ job.outputs.version }}"
|
uses: crazy-max/ghaction-import-gpg@v5
|
||||||
echo "Needs outputs:"
|
with:
|
||||||
echo " all: ${{ toJSON(needs) }}"
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
echo "::debug::Raw version value: ${{ steps.get_latest_tag.outputs.version }}"
|
passphrase: ${{ secrets.PASSPHRASE }}
|
||||||
|
git_config_global: true
|
||||||
|
git_user_signingkey: true
|
||||||
|
git_commit_gpgsign: true
|
||||||
|
git_tag_gpgsign: true
|
||||||
|
|
||||||
- name: Verify outputs
|
- name: Run GoReleaser
|
||||||
run: |
|
if: |
|
||||||
echo "GITHUB_OUTPUT contents:"
|
startsWith(github.ref, 'refs/tags/v') ||
|
||||||
cat $GITHUB_OUTPUT
|
(success() && steps.get_latest_tag.outputs.version != '')
|
||||||
echo "---"
|
uses: goreleaser/goreleaser-action@v4
|
||||||
echo "Direct version value: ${{ steps.get_latest_tag.outputs.version }}"
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: latest
|
||||||
|
args: release --clean --timeout 60m
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
|
VERSION: ${{ steps.get_latest_tag.outputs.version }}
|
||||||
|
|
||||||
- name: Debug Release Trigger
|
- name: Set Release Version
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
run: |
|
run: |
|
||||||
echo "Auto-tag completed successfully"
|
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
echo "Version to be released: ${{ steps.get_latest_tag.outputs.version }}"
|
|
||||||
echo "Checking release conditions:"
|
|
||||||
echo " - Version not empty: ${{ steps.get_latest_tag.outputs.version != '' }}"
|
|
||||||
echo " - Current job status: ${{ job.status }}"
|
|
||||||
|
|
||||||
- name: Check workflow status
|
- name: Verify Release
|
||||||
if: always()
|
if: |
|
||||||
|
startsWith(github.ref, 'refs/tags/v') ||
|
||||||
|
(success() && steps.get_latest_tag.outputs.version != '')
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ job.status }}" == "failure" ]]; then
|
echo "Verifying release artifacts..."
|
||||||
echo "::error::Auto-tag workflow failed"
|
if [ ! -d "dist" ]; then
|
||||||
|
echo "::error::Release artifacts not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
release:
|
- name: Notify on failure
|
||||||
needs: auto-tag
|
if: failure()
|
||||||
permissions:
|
run: |
|
||||||
contents: write
|
echo "::error::Release process failed"
|
||||||
packages: write
|
|
||||||
actions: write
|
|
||||||
if: |
|
|
||||||
needs.auto-tag.result == 'success' &&
|
|
||||||
needs.auto-tag.outputs.version != ''
|
|
||||||
uses: ./.github/workflows/release.yml
|
|
||||||
with:
|
|
||||||
version: ${{ needs.auto-tag.outputs.version }}
|
|
||||||
secrets:
|
|
||||||
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
||||||
PASSPHRASE: ${{ secrets.PASSPHRASE }}
|
|
97
.github/workflows/release.yml
vendored
97
.github/workflows/release.yml
vendored
@ -1,97 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: "Version to release"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
secrets:
|
|
||||||
RELEASE_TOKEN:
|
|
||||||
required: true
|
|
||||||
description: "GitHub token for release"
|
|
||||||
GPG_PRIVATE_KEY:
|
|
||||||
required: true
|
|
||||||
description: "GPG private key for signing"
|
|
||||||
PASSPHRASE:
|
|
||||||
required: true
|
|
||||||
description: "Passphrase for GPG key"
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
packages: write
|
|
||||||
actions: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
goreleaser:
|
|
||||||
environment: production
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
lfs: true
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: "1.21"
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/go-build
|
|
||||||
~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Import GPG key
|
|
||||||
id: import_gpg
|
|
||||||
uses: crazy-max/ghaction-import-gpg@v5
|
|
||||||
with:
|
|
||||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
||||||
passphrase: ${{ secrets.PASSPHRASE }}
|
|
||||||
git_config_global: true
|
|
||||||
git_user_signingkey: true
|
|
||||||
git_commit_gpgsign: true
|
|
||||||
git_tag_gpgsign: true
|
|
||||||
|
|
||||||
- name: Run GoReleaser
|
|
||||||
uses: goreleaser/goreleaser-action@v4
|
|
||||||
with:
|
|
||||||
distribution: goreleaser
|
|
||||||
version: latest
|
|
||||||
args: release --clean --timeout 60m
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
|
||||||
VERSION: ${{ inputs.version }}
|
|
||||||
|
|
||||||
- name: Notify on failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "::error::Release process failed"
|
|
||||||
|
|
||||||
- name: Verify Release
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "Verifying release artifacts..."
|
|
||||||
if [ ! -d "dist" ]; then
|
|
||||||
echo "::error::Release artifacts not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if: github.event_name == 'workflow_call' || startsWith(github.ref, 'refs/tags/v')
|
|
Loading…
x
Reference in New Issue
Block a user