-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (64 loc) · 2.14 KB
/
build.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
name: build
on:
push:
branches:
- main
- /^\d+\.\d+\.\d(-alpha\.\d+|-beta\.\d+|-rc\.\d+)?$/
tags:
- "*"
pull_request:
branches:
- main
jobs:
build:
name: Test, Build & Release
runs-on: "ubuntu-latest"
env:
LOGS_DIR: /tmp/eslint-config/logs
LOGS_FILE: /tmp/eslint-config/logs/build-perf.log
NPM_VERSION: "10.x"
TZ: "Europe/Brussels"
steps:
# See: https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3
# See: https://github.com/marketplace/actions/setup-node-js-environment
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Create file & folder for GitHub Actions logs
run: |
# cfr scripts/_ghactions-group.sh
mkdir -p $LOGS_DIR
touch $LOGS_FILE
- name: List main variables
run: |
echo "Commit SHA : ${GITHUB_SHA}"
echo "Branch/tag name : ${GITHUB_REF_NAME}"
echo "Reference : ${GITHUB_REF}"
echo "Reference type : ${GITHUB_REF_TYPE}"
echo "Repository : ${GITHUB_REPOSITORY}"
echo "Event : ${GITHUB_EVENT_NAME}"
echo "Author : ${GITHUB_ACTOR}"
NODE_VERSION="$(node -v)"
echo "Node version: $NODE_VERSION"
npm i -g npm@${NPM_VERSION}
# This ensures that we are authenticated without requiring to have an actual .npmrc file within the project
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
# See: https://github.com/marketplace/actions/upload-a-build-artifact
- uses: actions/upload-artifact@v3
with:
name: dist-${{ github.run_id }}
path: dist
- name: Release
run: npm run release:publish
if: github.ref_type == 'tag'
env:
GH_ACTIONS_TAG: ${{ github.ref_name }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Save logs
run: bash ./scripts/ci/print-logs.sh