generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (95 loc) · 3.36 KB
/
release-please.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.result }}
to_modify_pr: ${{ steps.release.outputs.pr && !steps.release.outputs.release_created }}
to_modify_release: ${{ steps.release.outputs.release_created }}
pr_number: ${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).number || '' }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: release-please-test
include-v-in-tag: false
pull-request-title-pattern: "chore${scope}: :bookmark: release${component} ${version}"
- name: Extract Version Number
uses: actions/github-script@v6
id: extract-version
if: ${{ steps.release.outputs.pr || steps.release.outputs.release_created }}
env:
PR_TITLE: ${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).title || ''}}
with:
script: |
const { PR_TITLE } = process.env
let ver = "";
if (PR_TITLE !== "") {
const pr_splitted = PR_TITLE.split(" ");
ver = pr_splitted[pr_splitted.length - 1];
}
if ('${{ steps.release.outputs.release_created }}' !== "") {
ver = "${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}"
}
return ver;
modify-pr:
needs: release-please
if: ${{ needs.release-please.outputs.to_modify_pr }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
- name: Append file to PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ needs.release-please.outputs.pr_number }}
NEW_VERSION=${{ needs.release-please.outputs.version }} task version-bump-beta
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git commit -am "chore(release): :bookmark: Bump version"
git push
modify-release:
needs: release-please
if: ${{ needs.release-please.outputs.to_modify_release }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
- name: NPM install
run:
npm ci --no-audit
- name: Build
run:
task build
- name: Upload Release Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release upload ${{ needs.release-please.outputs.tag_name }} ./dist/*
- name: Rename Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release edit ${{ needs.release-please.outputs.tag_name }} --title ${{ needs.release-please.outputs.version }}