Skip to content

Commit bb4aec2

Browse files
authored
Lint, Process and Release automatically
* Check with prettier * Correct file naming * use npm install * Add process action * Output * ouput * output * Add release step * Download artifact name * Move all actions into one file * Release
1 parent f2dd24b commit bb4aec2

5 files changed

Lines changed: 94 additions & 28 deletions

File tree

.github/workflows/build-pr.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Check, Build, Process and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Setup Node
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '16.x'
22+
- run: npm install
23+
- run: npx prettier . --check --config .prettierrc.json
24+
25+
process:
26+
name: Process
27+
needs: lint
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
- name: Setup Node
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: '16.x'
36+
- run: npm install
37+
- run: node process.mjs
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: generated-lookups
42+
path: output
43+
44+
release:
45+
name: 'Release'
46+
needs: process
47+
if: github.ref == 'refs/heads/main'
48+
runs-on: 'ubuntu-latest'
49+
steps:
50+
- name: Set current date as env variable
51+
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
52+
- uses: actions/download-artifact@v3
53+
with:
54+
name: generated-lookups
55+
- uses: 'marvinpinto/action-automatic-releases@latest'
56+
with:
57+
repo_token: '${{ secrets.GITHUB_TOKEN }}'
58+
automatic_release_tag: '${{ env.NOW }}'
59+
prerelease: false
60+
title: '${{ env.NOW }}'
61+
files: '*.json'

.prettierrc.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"jsonRecursiveSort": true,
3-
"plugins": [
4-
"prettier-plugin-sort-json"
5-
],
3+
"plugins": ["prettier-plugin-sort-json"],
64
"semi": false,
75
"singleAttributePerLine": true,
86
"singleQuote": true,

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"devDependencies": {
3-
"prettier-plugin-sort-json": "^3.1.0"
4-
}
2+
"devDependencies": {
3+
"prettier": "^3.1.0",
4+
"prettier-plugin-sort-json": "^3.1.0"
5+
}
56
}

pnpm-lock.yaml

Lines changed: 27 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const keys = ['readableName', 'deviceType', 'processorType', 'processorFamily']
1414
function prepare() {
1515
try {
1616
rmdirSync('./output', { recursive: true })
17-
} catch (err) {
18-
console.log(err)
19-
}
17+
} catch (err) {}
2018

2119
mkdirSync('./output')
2220
}

0 commit comments

Comments
 (0)