Skip to content

Commit 53d2552

Browse files
committed
chore: setup release
1 parent b63845f commit 53d2552

File tree

4 files changed

+73
-31
lines changed

4 files changed

+73
-31
lines changed
Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
1-
name: Build obsidian plugin
2-
31
on:
4-
push:
5-
# Sequence of patterns matched against refs/tags
6-
tags:
7-
- "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10
2+
workflow_dispatch:
83

4+
push:
5+
branches:
6+
- "main"
97
env:
10-
PLUGIN_NAME: obsidian-leaflet-plugin # Change this to the name of your plugin-id folder
8+
PLUGIN_NAME: obsidian-leaflet
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
name: release-please
1115

1216
jobs:
13-
build:
17+
release-please:
1418
runs-on: ubuntu-latest
19+
outputs:
20+
release_created: ${{ steps.release.outputs.release_created }}
21+
upload_url: ${{ steps.release.outputs.upload_url }}
22+
tag_name: ${{ steps.release.outputs.tag_name }}
23+
steps:
24+
- uses: google-github-actions/release-please-action@v3
25+
id: release
26+
with:
27+
command: manifest
1528

29+
upload-build:
30+
runs-on: ubuntu-latest
31+
needs: release-please
32+
if: ${{ needs.release-please.outputs.release_created }}
33+
env:
34+
upload_url: ${{ needs.release-please.outputs.upload_url }}
35+
tag_name: ${{ needs.release-please.outputs.tag_name }}
1636
steps:
1737
- uses: actions/checkout@v2
1838
- name: Use Node.js
1939
uses: actions/setup-node@v1
2040
with:
21-
node-version: "14.x" # You might need to adjust this value to your own version
41+
node-version: "18.x" # You might need to adjust this value to your own version
2242
- name: Build
2343
id: build
2444
run: |
@@ -27,40 +47,23 @@ jobs:
2747
mkdir ${{ env.PLUGIN_NAME }}
2848
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
2949
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
30-
ls
31-
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
32-
git config user.name "Jeremy Valentine"
33-
git config user.email [email protected]
34-
npx rexreplace "^.*?#(#+\s\[.*?\n.*?)(?=\s*#+\s\[)" "_" -s -M -G -m -o "CHANGELOG.md" > CHANGELOG-LATEST.md
35-
- name: Create Release
36-
id: create_release
37-
uses: actions/create-release@v1
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
VERSION: ${{ github.ref }}
41-
with:
42-
tag_name: ${{ github.ref }}
43-
release_name: ${{ github.ref }}
44-
body_path: CHANGELOG-LATEST.md
45-
draft: false
46-
prerelease: false
4750
- name: Upload zip file
4851
id: upload-zip
4952
uses: actions/upload-release-asset@v1
5053
env:
5154
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5255
with:
53-
upload_url: ${{ steps.create_release.outputs.upload_url }}
56+
upload_url: ${{ env.upload_url }}
5457
asset_path: ./${{ env.PLUGIN_NAME }}.zip
55-
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
58+
asset_name: ${{ env.PLUGIN_NAME }}-${{ env.tag_name }}.zip
5659
asset_content_type: application/zip
5760
- name: Upload main.js
5861
id: upload-main
5962
uses: actions/upload-release-asset@v1
6063
env:
6164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6265
with:
63-
upload_url: ${{ steps.create_release.outputs.upload_url }}
66+
upload_url: ${{ env.upload_url }}
6467
asset_path: ./main.js
6568
asset_name: main.js
6669
asset_content_type: text/javascript
@@ -70,7 +73,7 @@ jobs:
7073
env:
7174
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7275
with:
73-
upload_url: ${{ steps.create_release.outputs.upload_url }}
76+
upload_url: ${{ env.upload_url }}
7477
asset_path: ./manifest.json
7578
asset_name: manifest.json
7679
asset_content_type: application/json
@@ -80,7 +83,20 @@ jobs:
8083
env:
8184
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8285
with:
83-
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
upload_url: ${{ env.upload_url }}
8487
asset_path: ./styles.css
8588
asset_name: styles.css
8689
asset_content_type: text/css
90+
91+
publish:
92+
needs: release-please
93+
if: ${{ needs.release-please.outputs.release_created }}
94+
uses: javalent/workflows/.github/workflows/publish.yml@main
95+
secrets: inherit
96+
97+
upgrade-overload:
98+
needs: publish
99+
uses: javalent/obsidian-overload/.github/workflows/upgrade.yml@main
100+
secrets: inherit
101+
with:
102+
module: obsidian-leaflet

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/*
2+
!types/**/*
3+
!index.ts
4+
!tsconfig.json

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "3.5.4"
3+
}

release-please-config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"packages": {
3+
".": {
4+
"changelog-path": "CHANGELOG.md",
5+
"release-type": "node"
6+
}
7+
},
8+
"include-component-in-tag": false,
9+
"include-v-in-tag": false,
10+
"extra-files": [
11+
{
12+
"type": "json",
13+
"path": "manifest.json",
14+
"jsonpath": "$.version"
15+
}
16+
],
17+
"last-release-sha": "b63845f49c34ffda6816598eb415f348f4814d75",
18+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
19+
}

0 commit comments

Comments
 (0)