-
-
Notifications
You must be signed in to change notification settings - Fork 34
86 lines (85 loc) · 2.57 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (85 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release Obsidian Plugin
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: Release tag to build
required: true
type: string
draft:
description: Create the GitHub Release as a draft
required: false
type: boolean
default: true
prerelease:
description: Mark the GitHub Release as a pre-release
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Get Version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
TAG="${{ inputs.tag }}"
DRAFT="${{ inputs.draft }}"
PRERELEASE="${{ inputs.prerelease }}"
else
TAG="${GITHUB_REF_NAME}"
DRAFT="true"
PRERELEASE="false"
fi
echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"
echo "draft=${DRAFT}" >> "${GITHUB_OUTPUT}"
echo "prerelease=${PRERELEASE}" >> "${GITHUB_OUTPUT}"
- name: Validate release files
run: node release-process.mjs validate "${{ steps.version.outputs.tag }}"
- name: Build
id: build
run: |
npm ci
npm run build --if-present
- name: Attest Plugin Artifacts
uses: actions/attest-build-provenance@v4
with:
subject-path: |
main.js
manifest.json
styles.css
- name: Package
run: |
mkdir ${{ github.event.repository.name }}
cp main.js manifest.json styles.css README.md ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}-${{ steps.version.outputs.tag }}.zip ${{ github.event.repository.name }}
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
files: |
${{ github.event.repository.name }}-${{ steps.version.outputs.tag }}.zip
main.js
manifest.json
styles.css
name: ${{ steps.version.outputs.tag }}
tag_name: ${{ steps.version.outputs.tag }}
draft: ${{ steps.version.outputs.draft }}
prerelease: ${{ steps.version.outputs.prerelease }}