1.0.2 #7
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
name: Release | |
on: | |
release: | |
types: [published] | |
env: | |
package_type: module | |
node_version: 20 | |
fvtt_minimum: 11 | |
fvtt_verified: 11 | |
fvtt_dry_run: false | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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 | |
typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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: Typecheck | |
run: npm run typecheck | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
id: ${{ steps.get_id.outputs.id }} | |
version-without-v: ${{ steps.get_version.outputs.version-without-v }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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: Extract tag version number | |
id: get_version | |
uses: battila7/get-version-action@v2.2.1 | |
- name: Extract FoundryVTT id | |
id: get_id | |
run: | | |
value=$(jq -r '.id' src/${{ env.package_type }}.json) | |
echo "id is $value" | |
echo "id=$value" >> "$GITHUB_OUTPUT" | |
- name: Substitute Manifest and Download Links For Versioned Ones | |
id: sub_manifest_link_version | |
uses: microsoft/variable-substitution@v1 | |
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/${{ steps.get_id.outputs.id }}.json | |
download: https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/${{ steps.get_id.outputs.id }}.zip | |
- name: Build | |
run: npm run build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
publish: | |
needs: | |
- lint | |
- typecheck | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download production artifacts for publication | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Create zip file | |
working-directory: ./dist | |
run: zip -r ../${{ needs.build.outputs.id }}.zip . | |
- name: Copy manifest for vanity artifact name | |
run: cp ./dist/${{ env.package_type }}.json ./dist/${{ needs.build.outputs.id }}.json | |
- name: Create release | |
id: create_version_release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
name: ${{ github.event.release.name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: './dist/${{ needs.build.outputs.id }}.json, ./${{ needs.build.outputs.id }}.zip' | |
body: ${{ github.event.release.body }} | |
- name: Submit package to FoundryVTT Package Release API | |
run: | | |
curl -X POST 'https://api.foundryvtt.com/_api/packages/release_version/' \ | |
-H 'Content-Type: application/json' \ | |
-H 'Authorization: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}' \ | |
-d '{ | |
"id": "${{ needs.build.outputs.id }}", | |
"dry-run": ${{ env.fvtt_dry_run }}, | |
"release": { | |
"version": "${{ needs.build.outputs.version-without-v }}", | |
"manifest": "https://github.com/${{ github.repository }}/releases/download/${{ needs.build.outputs.version-without-v }}/${{ needs.build.outputs.id }}.json", | |
"notes": "https://github.com/${{ github.repository }}/releases/tag/${{ needs.build.outputs.version-without-v }}", | |
"compatibility": { | |
"minimum": "${{ env.fvtt_minimum }}", | |
"verified": "${{ env.fvtt_verified }}" | |
} | |
} | |
}' |