-
Notifications
You must be signed in to change notification settings - Fork 37
110 lines (92 loc) · 3.43 KB
/
test-release.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
110
name: Test and release
# Run the workflow when a Pull Request is opened or when changes are pushed to main on 'xdy/xdy-pf2e-workbench' (i.e. don't run on forks)
on:
pull_request:
push:
branches: [ main ]
env:
package_type: module
node_version: 20
jobs:
release:
# Only release on push to main on xdy/xdy-pf2e-workbench
if: github.event_name == 'push' && (github.ref == 'refs/heads/main') && github.repository == 'xdy/xdy-pf2e-workbench'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
# Not sure this is the right way to do it, but, eh, it works.
- name: Pull & update submodules recursively
run: |
git submodule update --init --recursive
git submodule update --recursive --remote
- uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
commit_message: "chore: Update submodules"
- name: Setup Node.js
uses: actions/setup-node@v4.1.0
with:
node-version: 20.x
cache: 'npm'
- name: Install
run: npm install
- name: install fvtt cli
id: fvtt-install
run: npm install -g @foundryvtt/foundryvtt-cli
- name: Build packs
run: npm run build:packs
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Get Module ID
id: moduleID
uses: notiz-dev/github-action-json-property@release
with:
path: "./dist/${{ env.package_type }}.json"
prop_path: "id"
- name: Get minimum
id: minimum
uses: notiz-dev/github-action-json-property@release
with:
path: "./dist/${{ env.package_type }}.json"
prop_path: "compatibility.minimum"
- name: Get verified
id: verified
uses: notiz-dev/github-action-json-property@release
with:
path: "./dist/${{ env.package_type }}.json"
prop_path: "compatibility.verified"
- name: Get maximum
id: maximum
uses: notiz-dev/github-action-json-property@release
with:
path: "./dist/${{ env.package_type }}.json"
prop_path: "compatibility.maximum"
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Submit package to FoundryVTT Package Release API
run: |
curl -X POST "https://api.foundryvtt.com/_api/packages/release_version/" \
-H "Content-Type: application/json" \
-H "Authorization: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}" \
-d '{
"id": "${{ steps.moduleID.outputs.prop }}",
"dry-run": false,
"release": {
"version": "${{ steps.package-version.outputs.current-version}}",
"manifest": "https://github.com/${{ github.repository }}/releases/latest/download/module.json",
"notes": "https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md",
"compatibility": {
"minimum": "${{ steps.minimum.outputs.prop }}",
"verified": "${{ steps.verified.outputs.prop }}",
"maximum": "${{ steps.maximum.outputs.prop }}"
}
}
}'