Release Creation #24
Workflow file for this run
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: Release Creation | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Populate Versioned keys in Manifest | |
id: sub_manifest_link_version | |
# Updated from microsoft/variable-substitution@v1 since that Action is deprecated. | |
# See #313 and https://github.com/DC23/jd-easytimekeeping/wiki/Dev-Ops#variable-substitution | |
uses: devops-actions/[email protected] | |
with: | |
files: 'module.json' | |
env: | |
version: ${{github.event.release.tag_name}} | |
url: https://github.com/${{github.repository}} | |
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json | |
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip | |
# `npm ci` is recommended: | |
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
- name: Install Dependencies | |
run: npm ci | |
# Rebuild the Foundry LevelDB compendia from the YAML intermediate files that we have in | |
# version control in src/packs/**.yml | |
# https://foundryvtt.wiki/en/development/api/CompendiumCollection#foundryvtt-cli | |
- name: Build Compendium Packs | |
run: npm run pullYMLtoLDB --if-present | |
# Create a "module.zip" archive containing all the module's required files. | |
- name: Create Module Archive | |
run: | | |
# Note that `zip` will only emit warnings when a file or directory | |
# doesn't exist, it will not fail. | |
zip --recurse-paths ./module.zip \ | |
module.json LICENSE \ | |
lang/ packs/ src/ styles/ templates/ | |
# 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: ${{ github.event.release.draft }} | |
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 }} |