Release #105
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
# SPDX-FileCopyrightText: 2022 Johannes Loher | |
# | |
# SPDX-License-Identifier: MIT | |
name: Release | |
on: | |
release: | |
types: [published] | |
env: | |
package_type: module | |
node_version: latest | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: .npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- name: Install dependencies | |
run: npm ci --cache .npm --prefer-offline | |
- name: Lint | |
run: npm run lint | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
cache: npm | |
- name: Extract tag version number | |
id: get_version | |
run: echo "version-without-v=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
- name: Substitute Manifest and Download Links For Versioned Ones | |
id: sub_manifest_link_version | |
uses: devops-actions/[email protected] | |
with: | |
files: "src/${{ env.package_type }}.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/${{ env.package_type }}.json | |
download: https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/${{ env.package_type }}.zip | |
- name: Publish Module to FoundryVTT Website | |
id: publish-to-foundry-website | |
uses: cs96and/[email protected] | |
if: ${{ !github.event.release.prerelease }} | |
env: | |
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} | |
with: | |
package-token: ${{ env.PACKAGE_TOKEN }} | |
manifest-url: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.json | |
- name: Build | |
run: | | |
npm ci | |
npm run build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Get Changelog Body | |
id: changelog | |
uses: release-flow/keep-a-changelog-action@v3 | |
with: | |
command: query | |
version: ${{ steps.get_version.outputs.version-without-v }} | |
publish: | |
needs: | |
- lint | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download production artifacts for publication | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Create zip file | |
working-directory: ./dist | |
run: zip -r ../${{ env.package_type }}.zip . | |
- name: Create release | |
if: ${{ !github.event.release.prerelease }} | |
id: create_version_release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
omitDraftDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
name: ${{ github.event.release.name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: "./dist/${{ env.package_type }}.json, ./${{ env.package_type }}.zip" | |
body: ${{ github.event.release.body }} | |
- name: Create pre-release | |
if: ${{ github.event.release.prerelease }} | |
id: create_version_prerelease | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
makeLatest: false | |
prerelease: true | |
name: ${{ github.event.release.name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: "./dist/${{ env.package_type }}.json, ./${{ env.package_type }}.zip" | |
body: ${{ github.event.release.body }} |