-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
124 lines (112 loc) · 4.26 KB
/
action.yml
File metadata and controls
124 lines (112 loc) · 4.26 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: DSI-HUG setup action
description: Reusable Github workflows mainly designed to be used by the HUG organization's team
author: "HUG - Hôpitaux Universitaires Genève"
branding:
icon: 'settings'
color: 'blue'
inputs:
node-version:
description: Node version to be used.
type: string
default: 22
node-arch:
description: Node architecture to be used.
type: string
default: ''
setup-chrome:
description: Whether to install the latest Chrome version.
type: boolean
default: false
GIT_USER_NAME:
description: Username to be used for Git configuration.
required: false
GIT_USER_EMAIL:
description: Email to be used for Git configuration.
required: false
GH_TOKEN:
description: GitHub token to be used for Git operations.
required: false
env:
HUSKY: 0
FORCE_COLOR: 3
runs:
using: 'composite'
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
# https://github.com/semantic-release/semantic-release/issues/2636
persist-credentials: false
# Nx recommmendation to ensure all Git history is available for Nx to evaluate
fetch-depth: 0
- name: Setup chrome (Windows)
if: ${{ inputs.setup-chrome && runner.os == 'Windows' }}
shell: pwsh
run: |
$ChromeInstallerFile = "googlechromestandaloneenterprise64.msi"
$ChromeInstallerUrl = "https://dl.google.com/tag/s/dl/chrome/install/${ChromeInstallerFile}"
$ChromeInstallerPath = Join-Path -Path "${env:Temp}" -ChildPath $ChromeInstallerFile
(New-Object System.Net.WebClient).DownloadFile($ChromeInstallerUrl, $ChromeInstallerPath)
Start-Process -FilePath msiexec.exe -ArgumentList "/i $ChromeInstallerPath /QN /norestart" -Wait -PassThru
- name: Setup chrome (Linux)
if: ${{ inputs.setup-chrome && runner.os == 'Linux' }}
shell: bash
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Setup chrome (macOS)
if: ${{ inputs.setup-chrome && runner.os == 'macOS' }}
shell: bash
run: |
wget -q https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
hdiutil attach -quiet -noautofsck -noautoopen googlechrome.dmg
sudo rm -rf "/Applications/Google Chrome.app"
sudo ditto "/Volumes/Google Chrome/Google Chrome.app" "/Applications/Google Chrome.app"
# https://github.com/actions/checkout/issues/664
- name: Setup git
shell: bash
run: |
git config user.name ${{ inputs.GIT_USER_NAME || github.actor }}
if [ "${{ inputs.GIT_USER_EMAIL }}" ]; then
git config user.email ${{ inputs.GIT_USER_EMAIL }}
else
git config user.email ${{ github.actor }}@users.noreply.github.com
fi
if [ "${{ inputs.GH_TOKEN }}" ]; then
git remote set-url origin https://x-access-token:${{ inputs.GH_TOKEN }}@github.com/${{ github.repository }}
fi
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
architecture: ${{ inputs.node-arch }}
registry-url: https://registry.npmjs.org/
cache: npm
# https://github.com/actions/setup-node/issues/411
# https://github.com/npm/cli/issues/4341
- name: Workaround for npm installation on Windows
if: ${{ runner.os == 'Windows' }}
shell: bash
run: npm install -g npm@8.3.1
- name: Setup npm
shell: bash
run: |
npm install -g npm@latest
npm --version
npm config list -l
- name: Cache .angular and node_modules
uses: actions/cache@v4
id: cache-step
with:
key: cache-${{ runner.os }}-node${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
cache-${{ runner.os }}-node${{ inputs.node-version }}-
path: |
.angular/cache
node_modules
- name: Install npm dependencies
if: steps.cache-step.outputs.cache-hit != 'true'
shell: bash
run: npm clean-install --engine-strict