-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (90 loc) · 5.18 KB
/
main.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
name: Module Builder
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
jobs:
build:
runs-on: ubuntu-latest
outputs:
release-notes: ${{ steps.set-release-notes.outputs.release-notes }}
steps:
- uses: actions/checkout@v4
- name: Set Release Notes for Github
id: set-release-notes-github
run: |
echo "- General:" >> release_notes.txt
echo " - 3rd Party Reactions: 3rd Party Reactions now support multiple GMs in the same world at the same time. After updating, the first active GM will be set as your Primary GM. This can then be modified in GPS Settings, which will give a list of GMs to choose from if more than one is present in a world. If this primary gm logs out or is no longer present in the world, the gm will fallback to the first active gm." >> release_notes.txt
echo " - 3rd Party Reactions: Item renaming is now possible as matching is done based on an ID stored on the item. This does mean the item needs to either be pulled from my compendiums or medkitted via cpr in order to work properly moving forward." >> release_notes.txt
echo " - Region Wrapping: Added setting (default true) for Region Wrapping. This wrapping is done to test additional points on a token when moving in/through a region (Foundry only tests the token center point). This was previously always on with my module in v12, you now have the ability to turn it off but I would not recommend it if trying to stay close to 5e rules." >> release_notes.txt
echo " - Cardinal Movement Helper: Added a return that will give the total movement that occurred." >> release_notes.txt
echo "- Updates:" >> release_notes.txt
echo " - Opportunity Attack: Add handling to temporarily disable Levels UI Picker on region deployment because it overrides default region handling" >> release_notes.txt
echo "- Bugfixes:" >> release_notes.txt
echo " - Vicious Mockery: Fix dialog not submitting with enter key correctly" >> release_notes.txt
echo "release-notes-github<<EOF" >> $GITHUB_ENV
cat release_notes.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Format Release Notes for Discord
id: format-release-notes-discord
run: |
DISCORD_NOTES=$(awk '{printf "%s\\n", $0}' release_notes.txt | sed 's/\\n$//')
echo "::set-output name=release-notes-discord::$DISCORD_NOTES"
- name: Get Version from Commit Message
id: get-version
run: |
version=$(git log -1 --pretty=%B | grep -o -E '[v]?[0-9]+\.[0-9]+\.[0-9]+' | sed 's/^v//')
echo "version=$version" >> $GITHUB_OUTPUT
echo "Extracted version: $version"
- name: Update module.json with Version
run: node update-module.js ${{ steps.get-version.outputs.version }}
- name: Zip Files
working-directory: ./
run: zip -r ./module.zip ./*
- name: Create Release
id: create-release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: Release ${{ steps.get-version.outputs.version }}
draft: false
prerelease: false
body: ${{ env.release-notes-github }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.zip, ./module.json'
tag: ${{ steps.get-version.outputs.version }}
- name: Release Foundry Package
run: |
curl -X POST "https://api.foundryvtt.com/_api/packages/release_version" \
-H "Content-Type: application/json" \
-H "Authorization: ${{ secrets.FOUNDRY_API_TOKEN }}" \
-d '{
"id": "'"gambits-premades"'",
"release": {
"version": "'"${{ steps.get-version.outputs.version }}"'",
"manifest": "'"https://github.com/gambit07/gambits-premades/releases/latest/download/module.json"'",
"download": "'"https://github.com/gambit07/gambits-premades/releases/download/${{ steps.get-version.outputs.version }}/module.zip"'",
"notes": "'"https://github.com/gambit07/gambits-premades/releases/tag/${{ steps.get-version.outputs.version }}"'",
"compatibility": {
"minimum": "'"12.328"'",
"verified": "'"12"'",
"maximum": "'"12"'"
}
}
}'
- name: Post to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MIDI_WEBHOOK }}
run: |
curl -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "Gambit'"'"'s Premades Release: ${{ steps.get-version.outputs.version }}",
"description": "**To support my continued work on this module!\n<https://ko-fi.com/gambit07> ❤️**\n\n${{ steps.format-release-notes-discord.outputs.release-notes-discord }}\n\nCheck it out through the Foundry package manager or the link below:\n<https://github.com/gambit07/gambits-premades/releases/tag/${{ steps.get-version.outputs.version }}>",
"image": {
"url": "https://avatars.githubusercontent.com/u/4236874?s=400&u=05d3718580ef87ea13467131a0c1fcaf4956630d&v=4"
}
}]
}' $DISCORD_WEBHOOK