asyouplz_SpeechNote/.github/workflows/release-auto.yml
2026-05-18 17:03:33 +09:00

84 lines
2.3 KiB
YAML

name: Automated Release
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
id-token: write
attestations: write
# Note: issues/pull-requests write permissions removed - not needed for current semantic-release config
jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
# Skip workflow for semantic-release commits to prevent infinite loops
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
# Generate GitHub App token to bypass repository rulesets
- name: Generate GitHub App Token
id: generate-token
uses: actions/create-github-app-token@v3.0.0-beta.1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint || true
- name: Run type checking
run: npm run typecheck
- name: Build plugin
run: |
npm run build
npm run build:css
- name: Verify build artifacts
run: |
for file in main.js manifest.json styles.css; do
if [ ! -s "$file" ]; then
echo "❌ $file is missing or empty"
exit 1
fi
done
# Syntax check for main.js
node -c main.js || { echo "❌ main.js has syntax errors"; exit 1; }
# Syntax check for manifest.json
node -e "JSON.parse(require('fs').readFileSync('manifest.json'))" || { echo "❌ manifest.json is invalid JSON"; exit 1; }
echo "✅ All build artifacts present, non-empty, and syntax is valid"
- name: Attest release assets
uses: actions/attest@v4
with:
subject-path: |
main.js
styles.css
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: npx semantic-release