generated from 4Source/obsidian-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (91 loc) · 2.72 KB
/
cd.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
103
104
105
106
107
108
109
name: Continuous Deployment
on:
pull_request:
types:
- closed
branches:
- master
workflow_dispatch:
jobs:
versioning:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Dependencies
run: npm install
- name: Bump version
id: version-bump
uses: 4Source/version-control-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
repository: ${{ github.event.repository.name }}
pr_number: ${{ github.event.number }}
tag_prefix: ''
dry_run: true
- name: Configure git
run: |
git config --global user.name "4Source"
git config --global user.email "[email protected]."
- name: Change version in files
run: |
npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }}
- name: Commit and push changes
run: |
git status
git add manifest.json versions.json package.json
git commit -m "Apply version ${{ steps.version-bump.outputs.new_version }}"
git push -f
outputs:
new_tag: ${{ steps.version-bump.outputs.new_tag }}
taging:
runs-on: ubuntu-latest
needs: versioning
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Push version tag
run: |
git tag -a ${{ needs.versioning.outputs.new_tag }} -m "${{ needs.versioning.outputs.new_tag }}"
git push -f origin ${{ needs.versioning.outputs.new_tag }}
build:
runs-on: ubuntu-latest
needs:
- versioning
- taging
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Dependencies
run: npm install
- name: Build plugin
run: npm run build
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.versioning.outputs.new_tag }}
run: |
gh release create "${{env.TAG}}" \
--title="${{env.TAG}}" \
--draft \
main.js manifest.json styles.css