发布流程简化

This commit is contained in:
lutinglt
2025-02-12 14:10:25 +08:00
parent b8d0e43074
commit c0d181278f
6 changed files with 28 additions and 14 deletions

16
.github/release.js vendored Normal file
View File

@@ -0,0 +1,16 @@
const fs = require('fs').promises;
const yaml = require('js-yaml');
async function parseYaml() {
try {
const fileContents = await fs.readFile('./theme.yml', 'utf8');
const data = yaml.load(fileContents);
console.log(data.gitea.version);
} catch (e) {
console.error('Error parsing YAML:', e.message);
process.exit(1);
}
}
parseYaml();

View File

@@ -2,10 +2,6 @@ name: release
on:
workflow_dispatch:
inputs:
gitea_version:
required: true
type: string
permissions:
contents: write
@@ -18,18 +14,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Build theme
run: |
npm install
npm run build
- uses: actions/upload-artifact@v4
with:
name: theme-github
path: dist/*
- name: NPM install
run: npm install
- name: Create release
run: |
export TZ=Asia/Shanghai
TAG="v${{ inputs.gitea_version }}-$(date +%Y%m%d-%H%M)"
TAG="v$(node .github/release.js)-$(date +%y%m%d%H%M)"
gh release create "$TAG" dist/* --notes-file .github/release.md --draft -t $TAG
env:
GH_TOKEN: ${{ github.token }}