-
-
Notifications
You must be signed in to change notification settings - Fork 6
121 lines (100 loc) · 3.62 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT
name: Publish
on:
push:
tags:
- "v*.*.*"
env:
node_version: 16
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install node
uses: actions/[email protected]
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:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install node
uses: actions/[email protected]
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: Build
run: npm run build
env:
NODE_ENV: production
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
publish:
needs:
- lint
- build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install node
uses: actions/[email protected]
with:
node-version: ${{ env.node_version }}
- 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 ../module.zip .
- name: Extract version
run: |
echo "::set-output name=version::$(jq -r '.version' package.json)"
id: extract_version
- name: Create release
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: false
name: ${{steps.extract_version.outputs.version}}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./module.json, ./module.zip"
- name: Publish to Foundry Admin
run: npx @ghost-fvtt/foundry-publish
env:
FVTT_MANIFEST_PATH: ./module.json
FVTT_PACKAGE_ID: ${{ secrets.FVTT_PACKAGE_ID }}
FVTT_USERNAME: ${{ secrets.FVTT_USERNAME }}
FVTT_PASSWORD: ${{ secrets.FVTT_PASSWORD }}
FVTT_DELETE_OBSOLETE_VERSIONS: true