forked from EmulatorJS/EmulatorJS
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (67 loc) · 2.13 KB
/
npm.yml
File metadata and controls
67 lines (67 loc) · 2.13 KB
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
name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
if: github.repository == 'EmulatorJS/EmulatorJS'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Get latest release tag (if workflow_dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
- name: Download cores
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ github.event.release.tag_name || env.LATEST_TAG }}
TRIMMED_TAG=${TAG_NAME#v}
echo "TRIMMED_TAG=$TRIMMED_TAG" >> $GITHUB_ENV
gh release download "$TAG_NAME" \
--repo ${{ github.repository }} \
--pattern "$TRIMMED_TAG.7z"
- name: Extract cores
run: |
7z x -y "$TRIMMED_TAG.7z" "data/cores/*" -o./
rm "$TRIMMED_TAG.7z"
- run: npm i
- name: Make @emulatorjs/emulatorjs
run: |
node build.js --npm=emulatorjs
npm ci
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get cores list
run: |
echo "CORES=$(node build.js --npm=get-cores | jq -r '. | join(" ")')" >> $GITHUB_ENV
- name: Setup cores
run: |
node build.js --npm=cores
- name: Publish each core
run: |
cd data/cores
for core in $CORES; do
echo "Processing core: $core"
cd $core
npm publish --access public
cd ..
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Make @emulatorjs/cores
run: |
cd data/cores
npm i
npm ci
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}