Skip to content

Release Creation

Release Creation #446

Workflow file for this run

name: Release Creation
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Install dependencies
- run: npm ci
- name: Webpack build
run: npm run build
# Remove the 'v' from the tag for versioning
- id: get_version
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "FOUNDRY_MANIFEST=https://github.com/${{github.repository}}/releases/latest/download/module.json" >> $GITHUB_ENV
echo "FOUNDRY_DOWNLOAD=https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip" >> $GITHUB_ENV
# Generate module.json
- id: generate_manifest
run: |
cat module-template.json > module.json
#Substitute the Manifest and Download URLs in the module.json
- name: Substitute Manifest and Download Links For Versioned Ones
id: sub_manifest_link_version
uses: restackio/[email protected]
with:
file: 'module.json'
fields: "{\"version\": \"${{env.VERSION}}\", \"manifest\": \"${{env.FOUNDRY_MANIFEST}}\", \"download\": \"${{env.FOUNDRY_DOWNLOAD}}\"}"
# create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip module.json dist packs styles templates LICENSE
# 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: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
- name: Foundry Release
id: foundry-release
run: node ./update-foundry-package.js
env:
FOUNDRY_API_TOKEN: ${{secrets.FOUNDRY_API_TOKEN}}
PACKAGE_ID: 'chris-premades'
PACKAGE_VERSION: '${{env.VERSION}}'
MANIFEST_URL: 'https://github.com/chrisk123999/chris-premades/releases/download/${{env.VERSION}}/module.json'
RELEASE_NOTES_URL: 'https://github.com/chrisk123999/chris-premades/releases/tag/${{env.VERSION}}'
FOUNDRY_MIN_VERSION: '11'
FOUNDRY_VERIFIED_VERSION: '11'
FOUNDRY_MAX_VERSION: '11'