Skip to content

Package Release

Package Release #8

Workflow file for this run

name: Package Release
env:
NODE_VERSION: 22
on:
release:
types: [published]
push:
branches:
- main
- add-github-action-for-release
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1. Checkout our repository so we can do things on it.
- name: Checkout
uses: actions/checkout@v4
# 2. Install Node
- name: Node Setup
uses: actions/setup-node@v3
with:
node-version: 22
# 3. Install node modules and build
- run: npm install
- run: npm run build
# 2. Get the version number without the leading -v.
- name: Get Version
id: get_version
uses: dhkatz/get-version-action@v3.0.0
- name: Test Version without V output
run: echo ${{steps.get_version.outputs.version-without-v}}
# 3. Substitute relevant values in system.json
- name: Substitute Manifest
uses: TomaszKandula/variable-substitution@v1.0.1
with:
files: "system.json"
env:
version: ${{steps.get_version.outputs.version-without-v}}
esmodules: |
["public/discworld.mjs"]
changelog: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/CHANGELOG.md
manifest: https://github.com/${{github.repository}}/releases/latest/download/system.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/discworld-modiphius.zip
# 4. Zip up the branch excluding unnecessary files/folders packs.
- name: Zip
# Only include needed dirs/files.
run: zip -r discworld-modiphius.zip system.json CHANGELOG.md LICENSE README.md assets lang public templates
# 5. Updates the release with the newly zipped branch and system.json. See documentation of this action for details.
- name: Update Release with Artifacts
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: true
name: v0.0.2
tag: v0.0.2
body: This is a test
artifacts: "./discworld-modiphius.zip, ./system.json, ./CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}