|
1 | | -# GitHub Actions workflow for creating a new FoundryVTT system release. |
2 | | -# |
3 | | -# Useful References: |
4 | | -# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
5 | | -# - https://docs.github.com/en/actions/learn-github-actions/contexts |
6 | | -# - https://docs.github.com/en/actions/learn-github-actions/environment-variables |
7 | | -# |
8 | | -# Troubleshooting Checklist: |
9 | | -# - Is the system's manifest file valid JSON? |
10 | | -# You can test your manifest file using https://jsonlint.com/. |
11 | | -# |
12 | | -# - Does the system's manifest have all the required keys? |
13 | | -# See https://foundryvtt.com/article/system-development/#manifest for more |
14 | | -# information. |
15 | | -# |
16 | | -# - Are all the proper files and directories being included in the release's |
17 | | -# system archive ("system.zip")? |
18 | | -# Check that the correct files are being passed to the `zip` command run |
19 | | -# in the "Create System Archive" step below. |
20 | | -# |
21 | | -# - Is the release tag the proper format? |
22 | | -# See the comments for the "Extract Version From Tag" step below. |
23 | | -# |
24 | | -# - Is a GitHub release being published? |
25 | | -# This workflow will only run when a release is published, not when a |
26 | | -# release is updated. Furthermore, note that while a GitHub release will |
27 | | -# (by default) create a repository tag, a repository tag will not create |
28 | | -# or publish a GitHub release. |
29 | | -# |
30 | | -# - Has the system's entry on FoundryVTT's system administration site |
31 | | -# (https://foundryvtt.com/admin) been updated? |
32 | | -# |
33 | | -name: Create System Files For GitHub Release |
34 | | - |
35 | | -env: |
36 | | - # The URL used for the system's "Project URL" link on FoundryVTT's website. |
37 | | - project_url: 'https://github.com/${{github.repository}}' |
38 | | - |
39 | | - # A URL that will always point to the latest manifest. |
40 | | - # FoundryVTT uses this URL to check whether the current module version that |
41 | | - # is installed is the latest version. This URL should NOT change, |
42 | | - # otherwise FoundryVTT won't be able to perform this check. |
43 | | - latest_manifest_url: 'https://github.com/${{github.repository}}/releases/latest/download/system.json' |
44 | | - |
45 | | - # The URL to the module archive associated with the module release being |
46 | | - # processed by this workflow. |
47 | | - release_system_url: 'https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/fabulaultima.zip' |
48 | | - |
49 | | -on: |
50 | | - # Only run this workflow when a release is published. |
51 | | - # To modify this workflow when other events occur, see: |
52 | | - # - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow |
53 | | - # - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows |
54 | | - # - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on |
55 | | - # |
56 | | - # Note that some steps may depend on context variables that are only |
57 | | - # available for release events, so if you add other events, you may need to |
58 | | - # alter other parts of this workflow. |
59 | | - release: |
60 | | - types: [published] |
61 | | - |
62 | | -jobs: |
63 | | - build: |
64 | | - runs-on: ubuntu-latest |
65 | | - permissions: |
66 | | - contents: write |
67 | | - |
68 | | - steps: |
69 | | - - name: Checkout Repository |
70 | | - uses: actions/checkout@v4 |
71 | | - |
72 | | - # Install @foundryvtt/foundryvtt-cli package |
73 | | - - name: Install foundryvtt-cli |
74 | | - run: npm install @foundryvtt/foundryvtt-cli |
75 | | - |
76 | | - # Extract version embedded in the tag. |
77 | | - # This step expects the tag to be one of the following formats: |
78 | | - # - "v<major>.<minor>.<patch>" (e.g., "v1.2.3") |
79 | | - # - "<major>.<minor>.<patch>" (e.g., "1.2.3") |
80 | | - # |
81 | | - # The version will be used by later steps to fill in the value for the |
82 | | - # "version" key required for a valid system manifest. |
83 | | - - name: Extract Version From Tag |
84 | | - id: get_version |
85 | | - uses: battila7/get-version-action@v2 |
86 | | - |
87 | | - # Modify "system.json" with values specific to the release. |
88 | | - # Since the values for the "version" and "url" keys aren't known ahead of |
89 | | - # time, the manifest file in the repository is updated with these values. |
90 | | - # |
91 | | - # While this does modify the manifest file in-place, the changes are not |
92 | | - # commited to the repository, and only exist in the action's filesystem. |
93 | | - - name: Modify System Manifest With Release-Specific Values |
94 | | - id: sub_manifest_link_version |
95 | | - uses: cschleiden/replace-tokens@v1 |
96 | | - with: |
97 | | - files: 'system.json' |
98 | | - env: |
99 | | - VERSION: ${{steps.get_version.outputs.version-without-v}} |
100 | | - URL: ${{ env.project_url }} |
101 | | - MANIFEST: ${{ env.latest_manifest_url }} |
102 | | - DOWNLOAD: ${{ env.release_system_url }} |
103 | | - |
104 | | - # Run npm script to convert YML to LDB before creating release |
105 | | - - name: Convert YML to LDB |
106 | | - run: npm run pullYMLtoLDB |
107 | | - working-directory: ./tools |
108 | | - |
109 | | - # Create a "fabulaultima.zip" archive containing all the system's required files. |
110 | | - # If you have other directories or files that will need to be added to |
111 | | - # your packaged system, add them here. |
112 | | - - name: Create System Archive |
113 | | - run: | |
114 | | - # Note that `zip` will only emit warnings when a file or directory |
115 | | - # doesn't exist, it will not fail. |
116 | | - zip \ |
117 | | - `# Options` \ |
118 | | - --recurse-paths \ |
119 | | - `# The name of the output file` \ |
120 | | - ./fabulaultima.zip \ |
121 | | - `# The files that will be included.` \ |
122 | | - template.json \ |
123 | | - system.json \ |
124 | | - README.md \ |
125 | | - LICENSE.md \ |
126 | | - CHANGELOG.md \ |
127 | | - templates \ |
128 | | - scripts/ \ |
129 | | - styles/ \ |
130 | | - packs/ \ |
131 | | - module \ |
132 | | - language/ \ |
133 | | - lang/ |
134 | | - # Don't forget to add a backslash at the end of the line for any |
135 | | - # additional files or directories! |
136 | | -
|
137 | | - # Update the GitHub release with the manifest and system archive files. |
138 | | - - name: Update Release With Files |
139 | | - id: create_version_release |
140 | | - uses: ncipollo/release-action@v1 |
141 | | - with: |
142 | | - allowUpdates: true |
143 | | - name: ${{ github.event.release.name }} |
144 | | - draft: ${{ github.event.release.unpublished }} |
145 | | - prerelease: ${{ github.event.release.prerelease }} |
146 | | - token: ${{ secrets.GITHUB_TOKEN }} |
147 | | - artifacts: './system.json, ./fabulaultima.zip' |
148 | | - tag: ${{ github.event.release.tag_name }} |
149 | | - body: ${{ github.event.release.body }} |
| 1 | +# GitHub Actions workflow for creating a new FoundryVTT system release. |
| 2 | +# |
| 3 | +# Useful References: |
| 4 | +# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
| 5 | +# - https://docs.github.com/en/actions/learn-github-actions/contexts |
| 6 | +# - https://docs.github.com/en/actions/learn-github-actions/environment-variables |
| 7 | +# |
| 8 | +# Troubleshooting Checklist: |
| 9 | +# - Is the system's manifest file valid JSON? |
| 10 | +# You can test your manifest file using https://jsonlint.com/. |
| 11 | +# |
| 12 | +# - Does the system's manifest have all the required keys? |
| 13 | +# See https://foundryvtt.com/article/system-development/#manifest for more |
| 14 | +# information. |
| 15 | +# |
| 16 | +# - Are all the proper files and directories being included in the release's |
| 17 | +# system archive ("system.zip")? |
| 18 | +# Check that the correct files are being passed to the `zip` command run |
| 19 | +# in the "Create System Archive" step below. |
| 20 | +# |
| 21 | +# - Is the release tag the proper format? |
| 22 | +# See the comments for the "Extract Version From Tag" step below. |
| 23 | +# |
| 24 | +# - Is a GitHub release being published? |
| 25 | +# This workflow will only run when a release is published, not when a |
| 26 | +# release is updated. Furthermore, note that while a GitHub release will |
| 27 | +# (by default) create a repository tag, a repository tag will not create |
| 28 | +# or publish a GitHub release. |
| 29 | +# |
| 30 | +# - Has the system's entry on FoundryVTT's system administration site |
| 31 | +# (https://foundryvtt.com/admin) been updated? |
| 32 | +# |
| 33 | +name: Create System Files For GitHub Release |
| 34 | + |
| 35 | +env: |
| 36 | + # The URL used for the system's "Project URL" link on FoundryVTT's website. |
| 37 | + project_url: 'https://github.com/${{github.repository}}' |
| 38 | + |
| 39 | + # A URL that will always point to the latest manifest. |
| 40 | + # FoundryVTT uses this URL to check whether the current module version that |
| 41 | + # is installed is the latest version. This URL should NOT change, |
| 42 | + # otherwise FoundryVTT won't be able to perform this check. |
| 43 | + latest_manifest_url: 'https://github.com/${{github.repository}}/releases/latest/download/system.json' |
| 44 | + |
| 45 | + # The URL to the module archive associated with the module release being |
| 46 | + # processed by this workflow. |
| 47 | + release_system_url: 'https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/fabulaultima.zip' |
| 48 | + |
| 49 | +on: |
| 50 | + # Only run this workflow when a release is published. |
| 51 | + # To modify this workflow when other events occur, see: |
| 52 | + # - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow |
| 53 | + # - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows |
| 54 | + # - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on |
| 55 | + # |
| 56 | + # Note that some steps may depend on context variables that are only |
| 57 | + # available for release events, so if you add other events, you may need to |
| 58 | + # alter other parts of this workflow. |
| 59 | + release: |
| 60 | + types: [published] |
| 61 | + |
| 62 | +jobs: |
| 63 | + build: |
| 64 | + runs-on: ubuntu-latest |
| 65 | + permissions: |
| 66 | + contents: write |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Checkout Repository |
| 70 | + uses: actions/checkout@v4 |
| 71 | + |
| 72 | + # Install @foundryvtt/foundryvtt-cli package |
| 73 | + - name: Install foundryvtt-cli |
| 74 | + run: npm install @foundryvtt/foundryvtt-cli |
| 75 | + |
| 76 | + # Extract version embedded in the tag. |
| 77 | + # This step expects the tag to be one of the following formats: |
| 78 | + # - "v<major>.<minor>.<patch>" (e.g., "v1.2.3") |
| 79 | + # - "<major>.<minor>.<patch>" (e.g., "1.2.3") |
| 80 | + # |
| 81 | + # The version will be used by later steps to fill in the value for the |
| 82 | + # "version" key required for a valid system manifest. |
| 83 | + - name: Extract Version From Tag |
| 84 | + id: get_version |
| 85 | + uses: battila7/get-version-action@v2 |
| 86 | + |
| 87 | + # Modify "system.json" with values specific to the release. |
| 88 | + # Since the values for the "version" and "url" keys aren't known ahead of |
| 89 | + # time, the manifest file in the repository is updated with these values. |
| 90 | + # |
| 91 | + # While this does modify the manifest file in-place, the changes are not |
| 92 | + # commited to the repository, and only exist in the action's filesystem. |
| 93 | + - name: Modify System Manifest With Release-Specific Values |
| 94 | + id: sub_manifest_link_version |
| 95 | + uses: cschleiden/replace-tokens@v1 |
| 96 | + with: |
| 97 | + files: 'system.json' |
| 98 | + env: |
| 99 | + VERSION: ${{steps.get_version.outputs.version-without-v}} |
| 100 | + URL: ${{ env.project_url }} |
| 101 | + MANIFEST: ${{ env.latest_manifest_url }} |
| 102 | + DOWNLOAD: ${{ env.release_system_url }} |
| 103 | + |
| 104 | + # Run npm script to convert YML to LDB before creating release |
| 105 | + - name: Convert YML to LDB |
| 106 | + run: npm run pullYMLtoLDB |
| 107 | + working-directory: ./tools |
| 108 | + |
| 109 | + # Create a "fabulaultima.zip" archive containing all the system's required files. |
| 110 | + # If you have other directories or files that will need to be added to |
| 111 | + # your packaged system, add them here. |
| 112 | + - name: Create System Archive |
| 113 | + run: | |
| 114 | + # Note that `zip` will only emit warnings when a file or directory |
| 115 | + # doesn't exist, it will not fail. |
| 116 | + zip \ |
| 117 | + `# Options` \ |
| 118 | + --recurse-paths \ |
| 119 | + `# The name of the output file` \ |
| 120 | + ./fabulaultima.zip \ |
| 121 | + `# The files that will be included.` \ |
| 122 | + template.json \ |
| 123 | + system.json \ |
| 124 | + README.md \ |
| 125 | + LICENSE.md \ |
| 126 | + CHANGELOG.md \ |
| 127 | + templates \ |
| 128 | + scripts/ \ |
| 129 | + styles/ \ |
| 130 | + packs/ \ |
| 131 | + module \ |
| 132 | + language/ \ |
| 133 | + lang/ |
| 134 | + # Don't forget to add a backslash at the end of the line for any |
| 135 | + # additional files or directories! |
| 136 | +
|
| 137 | + # Update the GitHub release with the manifest and system archive files. |
| 138 | + - name: Update Release With Files |
| 139 | + id: create_version_release |
| 140 | + uses: ncipollo/release-action@v1 |
| 141 | + with: |
| 142 | + allowUpdates: true |
| 143 | + name: ${{ github.event.release.name }} |
| 144 | + draft: ${{ github.event.release.unpublished }} |
| 145 | + prerelease: ${{ github.event.release.prerelease }} |
| 146 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 147 | + artifacts: './system.json, ./fabulaultima.zip' |
| 148 | + tag: ${{ github.event.release.tag_name }} |
| 149 | + body: ${{ github.event.release.body }} |
0 commit comments