Browse Source

ci: simplify and fix workflows

pull/85/head
dacrab 5 months ago
parent
commit
17c2cb9c2a
  1. 8
      .github/workflows/auto-tag.yml
  2. 91
      .github/workflows/release.yml

8
.github/workflows/auto-tag.yml

@ -8,7 +8,8 @@ on:
paths-ignore:
- '**.md'
- '.gitignore'
- '.github/**'
- '.github/workflows/**'
- 'LICENSE'
jobs:
auto-tag:
@ -19,6 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest tag
id: get_latest_tag
@ -38,5 +40,7 @@ jobs:
- name: Create new tag
run: |
new_tag=${{ steps.get_latest_tag.outputs.version }}
git tag $new_tag
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git tag -a $new_tag -m "Release $new_tag"
git push origin $new_tag

91
.github/workflows/release.yml

@ -7,35 +7,10 @@ on:
permissions:
contents: write
packages: write
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [amd64, arm64]
exclude:
- os: windows-latest
arch: arm64
- os: ubuntu-latest
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Run tests
run: go test -v ./...
release:
needs: test
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -48,15 +23,6 @@ jobs:
with:
go-version: '1.21'
cache: true
check-latest: true
- name: Install dependencies
run: go mod tidy
- name: Set Repository Variables
run: |
echo "GITHUB_REPOSITORY_OWNER=$(echo ${{ github.repository }} | cut -d '/' -f 1)" >> $GITHUB_ENV
echo "GITHUB_REPOSITORY_NAME=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
@ -66,56 +32,3 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 0
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: dist/*
retention-days: 5
- name: Generate changelog
if: success()
run: |
echo "# 🚀 Cursor ID Modifier ${{ github.ref_name }}" > ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "## ✨ Supported Platforms" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "### 🪟 Windows" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Windows x64 (64-bit)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Windows x86 (32-bit)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "### 🍎 macOS" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- macOS Intel (x64)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- macOS Apple Silicon (M1/M2)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "### 🐧 Linux" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Linux x64 (64-bit)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Linux x86 (32-bit)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Linux ARM64" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "## 📦 Quick Start" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "### Linux/macOS" >> ${{ github.workspace }}-CHANGELOG.txt
echo "\`\`\`bash" >> ${{ github.workspace }}-CHANGELOG.txt
echo "curl -fsSL https://raw.githubusercontent.com/dacrab/cursor-id-modifier/main/scripts/install.sh | sudo bash && cursor-id-modifier" >> ${{ github.workspace }}-CHANGELOG.txt
echo "\`\`\`" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "### Windows (PowerShell Admin)" >> ${{ github.workspace }}-CHANGELOG.txt
echo "\`\`\`powershell" >> ${{ github.workspace }}-CHANGELOG.txt
echo "irm https://raw.githubusercontent.com/dacrab/cursor-id-modifier/main/scripts/install.ps1 | iex; cursor-id-modifier" >> ${{ github.workspace }}-CHANGELOG.txt
echo "\`\`\`" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "## 🔄 Changes" >> ${{ github.workspace }}-CHANGELOG.txt
echo "* 📦 Release version: ${{ github.ref_name }}" >> ${{ github.workspace }}-CHANGELOG.txt
echo "* 📝 Full changelog: https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}" >> ${{ github.workspace }}-CHANGELOG.txt
echo "" >> ${{ github.workspace }}-CHANGELOG.txt
echo "## 🔍 Download Files" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Windows: \`cursor-id-modifier_${{ github.ref_name }}_Windows_[x64/x86].zip\`" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- macOS: \`cursor-id-modifier_${{ github.ref_name }}_macOS_[x64/arm64]_[intel/apple_silicon].tar.gz\`" >> ${{ github.workspace }}-CHANGELOG.txt
echo "- Linux: \`cursor-id-modifier_${{ github.ref_name }}_Linux_[x64/x86/arm64].tar.gz\`" >> ${{ github.workspace }}-CHANGELOG.txt
Loading…
Cancel
Save