-
-
Notifications
You must be signed in to change notification settings - Fork 48
80 lines (65 loc) · 2.26 KB
/
Copy pathrelease.yaml
File metadata and controls
80 lines (65 loc) · 2.26 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
# https://github.com/SilentVoid13/Templater/blob/master/.github/workflows/release.yml
name: Plugin release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
id-token: write
contents: write
attestations: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Fetch all branches
run: git fetch --all
- name: Extract branch name
run: |
BRANCH_NAME=$(git name-rev --name-only $GITHUB_SHA | sed 's|^remotes/origin/||' | sed 's|^origin/||')
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
# Checkout the main branch to update manifest.json
- name: Checkout main branch to update manifest
run: |
git checkout main
git pull origin main
- name: Update manifest.json in main branch
run: |
VERSION=${GITHUB_REF#refs/tags/}
jq --arg version "$VERSION" '.version = $version' manifest.json > manifest-temp.json
mv manifest-temp.json manifest.json
- name: Commit and push manifest.json changes in main
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add manifest.json
git commit -m "Update manifest.json to version $VERSION" || echo "No changes to commit"
git push origin main
- name: Ensure HEAD is at updated main commit
run: |
git fetch origin
git checkout main
git reset --hard origin/main
- name: npm build
run: |
npm install
npm run fn-build --if-present
- name: Generate artifact attestation for main.js
uses: actions/attest@v4
with:
subject-path: 'main.js'
- name: Generate artifact attestation for styles.css
uses: actions/attest@v4
with:
subject-path: 'styles.css'
- name: Create Plugin release
uses: ncipollo/release-action@v1.12.0
with:
artifacts: "main.js,manifest.json,styles.css"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}