-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 3.12 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
# Based on the workflows of:
# https://github.com/League-of-Foundry-Developers/FoundryVTT-Module-Template and
# https://github.com/pwatson100/alienrpg
name: Release Creation
env:
# The URL used for the system's "Project URL" link on FoundryVTT's website.
project_url: "https://github.com/${{github.repository}}"
# A URL that will always point to the latest manifest.
# FoundryVTT uses this URL to check whether the current system version that
# is installed is the latest version. This URL should NOT change,
# otherwise FoundryVTT won't be able to perform this check.
latest_manifest_url: "https://github.com/${{github.repository}}/releases/latest/download/system.json"
# The URL to the system archive associated with the system release being
# processed by this workflow.
release_system_url: "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/system.zip"
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
# Extract version embedded in the tag.
# This step expects the tag to be one of the following formats:
# - "v<major>.<minor>.<patch>" (e.g., "v1.2.3")
# - "<major>.<minor>.<patch>" (e.g., "1.2.3")
#
# The version will be used by later steps to fill in the value for the
# "version" key required for a valid system manifest.
- name: Extract Version From Tag
id: get_version
uses: battila7/get-version-action@v2
# Modify "system.json" with values specific to the release.
# Since the values for the "version" and "url" keys aren't known ahead of
# time, the manifest file in the repository is updated with these values.
#
# While this does modify the manifest file in-place, the changes are not
# commited to the repository, and only exist in the action's filesystem.
- name: Modify system Manifest With Release-Specific Values
id: sub_manifest_link_version
uses: cschleiden/replace-tokens@v1
with:
files: 'system.json'
env:
VERSION: ${{steps.get_version.outputs.version-without-v}}
URL: ${{ env.project_url }}
MANIFEST: ${{ env.latest_manifest_url }}
DOWNLOAD: ${{ env.release_system_url }}
# create a zip file with all files required by the system to add to the release
- run: zip -r ./system.zip system.json template.json README.md LICENSE templates/ module/ lang/ css/ assets/
# Create a release for this specific version
- name: Update Release with Files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true # set this to false if you want to prevent updating existing releases
name: ${{ github.event.release.name }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./system.json, ./system.zip"
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}