fancive_obsidian-parallel-r.../.github/workflows/release.yml
wujunchen d00075779e ci: make release upload idempotent
Change-Id: I826fcc302c0ea20877c66045e1e264efa7dbb3d5
2026-05-09 11:16:59 +08:00

54 lines
1.2 KiB
YAML

name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Lint
run: npm run lint
- name: E2E gate
run: timeout 600 npm run e2e
- name: Upload e2e artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-${{ github.run_id }}
if-no-files-found: ignore
path: |
.e2e/artifact.json
.e2e/results/
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
if gh release view "$tag" >/dev/null 2>&1; then
gh release upload "$tag" --clobber main.js main.js.map manifest.json styles.css
else
gh release create "$tag" \
--title "$tag" \
--generate-notes \
main.js main.js.map manifest.json styles.css
fi