-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (114 loc) · 3.89 KB
/
main.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
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
125
126
127
128
129
130
131
132
name: main
on:
- push
- pull_request
env:
HUSKY: 0
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: yarn
- name: Get yarn cache directory path
id: init
shell: bash
run: |
echo "::set-output name=yarn_cache::$(yarn cache dir)"
#
echo "Node $(node --version)"
echo "NPM $(npm --version)"
echo "Npx $(npx --version)"
echo "Yarn $(yarn --version)"
#
# HACK(douglasduteil): symlink node to /usr/bin/node
# Avoid the npx jest error on e2e tests
# /usr/bin/env: 'node': No such file or directory
# see https://github.com/nodejs/node-v0.x-archive/issues/3911
sudo ln -s $(which node) /usr/bin/node
- name: Installing
run: yarn --frozen-lockfile --perfer-offline --link-duplicates
- name: Upgrade yarn.lock files in templates according to @socialgouv/kosko-charts root project
shell: bash
run: |
cd templates
TEMPLATES_DIR=$(pwd)
for TEMPLATE_DIR in */; do
cd $TEMPLATES_DIR/$TEMPLATE_DIR
node -e "
const package = JSON.parse(fs.readFileSync('package.json'));
const tmpPackage = {
...package,
resolutions: {
...(package.resolutions || {}),
'@socialgouv/kosko-charts': 'link:../..'
}
};
fs.writeFileSync('package.json', JSON.stringify(tmpPackage, null, 2));"
yarn --perfer-offline
node -e "
const tmpPackage = JSON.parse(fs.readFileSync('package.json'));
const package = {
...tmpPackage,
resolutions: Object.entries(tmpPackage.resolutions).reduce((acc, [key, value]) => {
if(key !== '@socialgouv/kosko-charts'){
acc[key] = value;
}
return acc;
},{})
};
if(Object.keys(package.resolutions).length===0){
delete package.resolutions;
}
fs.writeFileSync('package.json', JSON.stringify(package, null, 2));"
echo "templates/${TEMPLATE_DIR}yarn.lock" updated
done
- name: Lint
run: yarn lint
- name: Unit tests
run: yarn test --coverage --coverageReporters=lcov --coverageReporters=text-summary
- name: Build
run: yarn build
- name: Functional tests
run: yarn e2e
- name: Build to lib folder for archives
run: yarn build --outDir lib
- name: Archive lib components
uses: actions/upload-artifact@v2
with:
name: components
path: lib/
release:
needs:
- build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*
- name: Download lib form build job
uses: actions/download-artifact@v2
with:
name: components
path: .
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
env:
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}