-
Notifications
You must be signed in to change notification settings - Fork 53
77 lines (71 loc) · 1.99 KB
/
action.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
---
name: action
on:
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_dispatch: {}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
version:
name: Version with commit unique id
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Version it!
run: |
# We expect a string such as const setupBeamVersion = 'undefined' in the code
SHA=$(git rev-parse --short HEAD)
sed -i'.bak' \
-e "s/const setupBeamVersion = '.*'/const setupBeamVersion = '${SHA}'/g" \
src/setup-beam.js
npm run build-dist
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add src/setup-beam.js
git add dist/index.js
git commit -m "Automation: update setup-beam version output to ${SHA}"
git push origin main
check_integrity:
name: Expected local npm actions
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm run build-dist
- name: Check if build left artifacts
run: git diff --exit-code --ignore-space-at-eol
unit_tests_ubuntu:
name: Unit tests (Ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm test
- name: .tool-versions test
id: setup-beam
uses: ./
with:
version-file: test/.tool-versions
version-type: strict
unit_tests_windows:
name: Unit tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install --production
- run: npm test