mirror of
https://github.com/sean2077/obsidian-dynamic-theme-background.git
synced 2026-07-22 06:44:57 +00:00
92 lines
3.1 KiB
YAML
92 lines
3.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "[0-9]*.[0-9]*.[0-9]*"
|
|
|
|
permissions:
|
|
attestations: write
|
|
contents: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: release-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Install locked dependencies
|
|
run: npm ci
|
|
|
|
- name: Verify tag is published from master
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git fetch origin master
|
|
test "$(git cat-file -t "$GITHUB_REF_NAME")" = "tag"
|
|
tag_commit="$(git rev-parse "${GITHUB_REF_NAME}^{commit}")"
|
|
test "$(git rev-parse HEAD)" = "$tag_commit"
|
|
git merge-base --is-ancestor "$tag_commit" origin/master
|
|
|
|
- name: Verify release contract
|
|
run: npm run release:verify -- "$GITHUB_REF_NAME"
|
|
|
|
- name: Run required checks
|
|
run: npm run check
|
|
|
|
- name: Attest release assets
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: |
|
|
main.js
|
|
styles.css
|
|
|
|
- name: Extract release notes
|
|
run: npm run release:notes -- "$GITHUB_REF_NAME" "$RUNNER_TEMP/release-notes.md"
|
|
|
|
- name: Publish GitHub release
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
RELEASE_TAG: ${{ github.ref_name }}
|
|
run: |
|
|
set -euo pipefail
|
|
notes="$RUNNER_TEMP/release-notes.md"
|
|
prerelease=false
|
|
[[ "$RELEASE_TAG" == *-* ]] && prerelease=true
|
|
|
|
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
|
|
gh release edit "$RELEASE_TAG" \
|
|
--title "$RELEASE_TAG" \
|
|
--notes-file "$notes" \
|
|
--prerelease="$prerelease"
|
|
else
|
|
gh release create "$RELEASE_TAG" \
|
|
--verify-tag \
|
|
--target "$(git rev-parse HEAD)" \
|
|
--title "$RELEASE_TAG" \
|
|
--notes-file "$notes" \
|
|
--prerelease="$prerelease" \
|
|
--draft
|
|
fi
|
|
|
|
gh release upload "$RELEASE_TAG" main.js manifest.json styles.css --clobber
|
|
gh release edit "$RELEASE_TAG" --draft=false
|
|
test "$(gh release view "$RELEASE_TAG" --json isDraft --jq .isDraft)" = "false"
|
|
test "$(gh release view "$RELEASE_TAG" --json assets --jq '.assets | map(.name) | sort | join(",")')" = \
|
|
"main.js,manifest.json,styles.css"
|