-
-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (69 loc) · 3.17 KB
/
Copy pathmain.yml
File metadata and controls
82 lines (69 loc) · 3.17 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
81
82
name: Release Creation
on:
release:
types: [published]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure git to use HTTPS
run: git config --global url."https://github.com/".insteadOf "git@github.com:"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Validate module.json
run: jq empty module.json
- name: Update module.json with release info
run: |
VERSION="${GITHUB_REF_NAME#v}"
jq \
--arg v "$VERSION" \
--arg url "https://github.com/${{ github.repository }}" \
--arg manifest "https://github.com/${{ github.repository }}/releases/latest/download/module.json" \
--arg download "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/module.zip" \
--arg bugs "https://github.com/${{ github.repository }}/issues" \
--arg changelog "https://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }}" \
--arg readme "https://github.com/${{ github.repository }}/blob/${{ github.event.release.tag_name }}/README.md" \
'.version=$v | .url=$url | .manifest=$manifest | .download=$download | .bugs=$bugs | .changelog=$changelog | .readme=$readme' \
module.json > module.tmp.json && mv module.tmp.json module.json
- name: Create module.zip
run: zip -r ./module.zip module.json LICENSE README.md images/ languages/ dist/
- name: Upload release artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: ${{ github.event.release.name }}
draft: ${{ github.event.release.unpublished }}
prerelease: ${{ github.event.release.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
- name: Publish to Foundry VTT
env:
FOUNDRY_PACKAGE_TOKEN: ${{ secrets.FOUNDRY_PACKAGE_TOKEN }}
if: ${{ env.FOUNDRY_PACKAGE_TOKEN != '' }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
curl -sf -X POST "https://foundryvtt.com/_api/packages/release_version/" \
-H "Content-Type: application/json" \
-H "Authorization: $FOUNDRY_PACKAGE_TOKEN" \
-d "{
\"id\": \"pause-customizer\",
\"release\": {
\"version\": \"${VERSION}\",
\"manifest\": \"https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/module.json\",
\"notes\": \"https://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }}\",
\"compatibility\": $(jq '.compatibility' module.json)
}
}"