Skip to content

Commit 5debfba

Browse files
authored
Update GitHub actions (#197)
1 parent bd0411a commit 5debfba

File tree

2 files changed

+43
-34
lines changed

2 files changed

+43
-34
lines changed

.github/workflows/esm-lint.yml

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
env:
2-
IMPORT_TEXT: import * as pageDetect from
3-
NPM_MODULE_NAME: github-url-detection
2+
IMPORT_STATEMENT: import * as pageDetect from "github-url-detection"
43

54
# FILE GENERATED WITH: npx ghat fregante/ghatemplates/esm-lint
65
# SOURCE: https://github.com/fregante/ghatemplates
@@ -19,77 +18,87 @@ jobs:
1918
Pack:
2019
runs-on: ubuntu-latest
2120
steps:
22-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2322
- run: npm install
2423
- run: npm run build --if-present
2524
- run: npm pack --dry-run
2625
- run: npm pack | tail -1 | xargs -n1 tar -xzf
27-
- uses: actions/upload-artifact@v3
26+
- uses: actions/upload-artifact@v4
2827
with:
2928
path: package
29+
Publint:
30+
runs-on: ubuntu-latest
31+
needs: Pack
32+
steps:
33+
- uses: actions/download-artifact@v4
34+
- run: npx publint ./artifact
3035
Webpack:
3136
runs-on: ubuntu-latest
3237
needs: Pack
3338
steps:
34-
- uses: actions/download-artifact@v3
35-
- run: npm install ./artifact
36-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
39+
- uses: actions/download-artifact@v4
40+
- run: npm install --omit=dev ./artifact
41+
- run: echo "$IMPORT_STATEMENT" > index.js
3742
- run: webpack --entry ./index.js
3843
- run: cat dist/main.js
3944
Parcel:
4045
runs-on: ubuntu-latest
4146
needs: Pack
4247
steps:
43-
- uses: actions/download-artifact@v3
44-
- run: npm install ./artifact
45-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
48+
- uses: actions/download-artifact@v4
49+
- run: npm install --omit=dev ./artifact
50+
- run: echo "$IMPORT_STATEMENT" > index.js
51+
- run: >
52+
echo '{"@parcel/resolver-default": {"packageExports": true}}' >
53+
package.json
4654
- run: npx parcel@2 build index.js
4755
- run: cat dist/index.js
4856
Rollup:
4957
runs-on: ubuntu-latest
5058
needs: Pack
5159
steps:
52-
- uses: actions/download-artifact@v3
53-
- run: npm install ./artifact rollup@2 @rollup/plugin-node-resolve
54-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
60+
- uses: actions/download-artifact@v4
61+
- run: npm install --omit=dev ./artifact rollup@2 @rollup/plugin-node-resolve
62+
- run: echo "$IMPORT_STATEMENT" > index.js
5563
- run: npx rollup -p node-resolve index.js
5664
Vite:
5765
runs-on: ubuntu-latest
5866
needs: Pack
5967
steps:
60-
- uses: actions/download-artifact@v3
61-
- run: npm install ./artifact
62-
- run: >-
63-
echo '<script type="module">${{ env.IMPORT_TEXT }} "${{
64-
env.NPM_MODULE_NAME }}"</script>' > index.html
68+
- uses: actions/download-artifact@v4
69+
- run: npm install --omit=dev ./artifact
70+
- run: echo '<script type="module">$IMPORT_STATEMENT</script>' > index.html
6571
- run: npx vite build
6672
- run: cat dist/assets/*
6773
esbuild:
6874
runs-on: ubuntu-latest
6975
needs: Pack
7076
steps:
71-
- uses: actions/download-artifact@v3
77+
- uses: actions/download-artifact@v4
7278
- run: echo '{}' > package.json
73-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.js
74-
- run: npm install ./artifact
79+
- run: echo "$IMPORT_STATEMENT" > index.js
80+
- run: npm install --omit=dev ./artifact
7581
- run: npx esbuild --bundle index.js
7682
TypeScript:
7783
runs-on: ubuntu-latest
7884
needs: Pack
7985
steps:
80-
- uses: actions/download-artifact@v3
81-
- run: npm install ./artifact
82-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.ts
83-
- run: tsc index.ts
84-
- run: cat index.js
86+
- uses: actions/download-artifact@v4
87+
- run: npm install --omit=dev ./artifact @sindresorhus/tsconfig
88+
- run: echo "$IMPORT_STATEMENT" > index.ts
89+
- run: >
90+
echo '{"extends":"@sindresorhus/tsconfig","files":["index.ts"]}' >
91+
tsconfig.json
92+
- run: npx --package typescript -- tsc
93+
- run: cat distribution/index.js
8594
Node:
8695
runs-on: ubuntu-latest
8796
needs: Pack
8897
steps:
89-
- uses: actions/download-artifact@v3
90-
- uses: actions/setup-node@v3
98+
- uses: actions/download-artifact@v4
99+
- uses: actions/setup-node@v4
91100
with:
92-
node-version: 14.x
93-
- run: echo "${{ env.IMPORT_TEXT }} '${{ env.NPM_MODULE_NAME }}'" > index.mjs
94-
- run: npm install ./artifact
101+
node-version-file: artifact/package.json
102+
- run: echo "$IMPORT_STATEMENT" > index.mjs
103+
- run: npm install --omit=dev ./artifact
95104
- run: node index.mjs

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
NPM:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v3
23-
- uses: actions/setup-node@v3
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
2424
with:
25-
node-version: 18
25+
node-version-file: package.json
2626
registry-url: https://registry.npmjs.org
2727
- run: npm ci || npm install
2828
- uses: fregante/setup-git-user@v2

0 commit comments

Comments
 (0)