Update main.yml #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions workflow for creating a new FoundryVTT module release. | |
# | |
# Useful References: | |
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# - https://docs.github.com/en/actions/learn-github-actions/contexts | |
# - https://docs.github.com/en/actions/learn-github-actions/environment-variables | |
# | |
# Troubleshooting Checklist: | |
# - Is the module's manifest file valid JSON? | |
# You can test your manifest file using https://jsonlint.com/. | |
# | |
# - Does the module's manifest have all the required keys? | |
# See https://foundryvtt.com/article/module-development/#manifest for more | |
# information. | |
# | |
# - Are all the proper files and directories being included in the release's | |
# module archive ("module.zip")? | |
# Check that the correct files are being passed to the `zip` command run | |
# in the "Create Module Archive" step below. | |
# | |
# - Is the release tag the proper format? | |
# See the comments for the "Extract Version From Tag" step below. | |
# | |
# - Is a GitHub release being published? | |
# This workflow will only run when a release is published, not when a | |
# release is updated. Furthermore, note that while a GitHub release will | |
# (by default) create a repository tag, a repository tag will not create | |
# or publish a GitHub release. | |
# | |
# - Has the module's entry on FoundryVTT's module administration site | |
# (https://foundryvtt.com/admin) been updated? | |
name: Create Module Files For GitHub Release | |
env: | |
# The URL used for the module'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 module 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/module.json" | |
# The URL used for FoundryVTT to download the latest module archive file. | |
release_module_url: "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip" | |
jobs: | |
build: | |
runs-on: ubuntu-latest # Use the latest Ubuntu environment | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 # Updated to use latest Node.js support | |
- name: Set up Node.js # Set up a Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Get version | |
id: version | |
uses: battila7/get-version-action@v3 # Updated to support Node.js 20 | |
with: | |
file: 'module.json' | |
- name: Create Module Archive # Create the zip file with all necessary contents | |
run: | | |
zip --recurse-paths waterdeep-city-of-splendors.zip \ | |
module.json \ | |
README.md \ | |
LICENSE \ | |
images/ \ | |
scripts/ \ | |
packs/ | |
shell: bash # Set shell to bash | |
- name: Upload release artifact # Upload the zip file as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: waterdeep-city-of-splendors | |
path: waterdeep-city-of-splendors.zip | |
- name: Set environment file for version # Store version for later use | |
run: echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV | |
- name: Update Release With Files # Update the GitHub release with the manifest and zip | |
id: create_version_release | |
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: Notify on version bump # Notify version bump log | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: echo "Released Waterdeep City of Splendors v${{ env.version }}" |