Skip to content

v1.0.0

v1.0.0 #1

Workflow file for this run

# 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
strategy:
matrix:
node-version: [20.x]
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# 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 module manifest.
- name: Extract Version From Tag
id: get_version
uses: battila7/get-version-action@v2
# Modify "module.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 Module Manifest With Release-Specific Values
id: sub_manifest_link_version
uses: cschleiden/replace-tokens@v1
with:
files: "module.json"
env:
VERSION: ${{steps.get_version.outputs.version-without-v}}
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
# Create a "module.zip" archive containing all the module's required files.
# If you have other directories or files that will need to be added to
# your packaged module, add them here.
# Create a zip file with all files required by the module to add to the release
- name: Create Module Archive
run: zip -r ./module.zip module.json package.json LICENSE README.md lang/ packs/ styles/ dist/
# Update the GitHub release with the manifest and module archive files.
- name: Update Release With Files
id: create_version_release
uses: ncipollo/[email protected]
with:
allowUpdates: true
name: ${{ github.event.release.name }}
draft: false
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 }}