-
-
Notifications
You must be signed in to change notification settings - Fork 146
110 lines (102 loc) · 2.91 KB
/
core-ci-cd-prod.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
name: Leapp Core CI/CD - prod
on:
push:
branches:
- 'master'
workflow_dispatch:
jobs:
build_and_test:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
node_version: [ 16 ]
env:
SKIP_INTEGRATION_TESTS: "true"
S3_BUCKET: s3://noovolari-leapp-website-distribution
runs-on: ${{ matrix.os }}
steps:
- name: Prepare GIT
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- name: Bootstrap
run: |
npm install
cd packages/core
npm install
- name: Build
run: |
cd packages/core
npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Test
run: |
npm run make-badges-core
- name: Send badge to S3
shell: bash
run: |
cd coverage
aws s3 cp core-badges.svg "${{ env.S3_BUCKET }}/coverage-badges/"
- name: Lint
run: |
npm run lint
check_for_release:
needs: build_and_test
runs-on: ubuntu-latest
outputs:
to-release: ${{ steps.validator.outputs.VALID_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master
- name: Check Tag Validity
id: validator
run: |
git fetch
TAG=$(git tag --points-at $GITHUB_SHA)
MATCH=$(echo "$TAG" | grep "^core-v[0-9]\+\.[0-9]\+\.[0-9]\+$" || true)
if [[ $MATCH != "" ]]; then IS_VALID_TAG=1; else IS_VALID_TAG=0; fi;
echo "::set-output name=VALID_TAG::$IS_VALID_TAG"
- name: If valid tag set
if: steps.validator.outputs.VALID_TAG == 1
run: |
echo "Valid Tag - Releasing..."
- name: If not valid tag set
if: steps.validator.outputs.VALID_TAG != 1
run: |
echo "Invalid Tag - Not releasing"
release:
needs: check_for_release
runs-on: ubuntu-latest
if: needs.check_for_release.outputs.to-release == 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Bootstrap
run: |
npm install
cd packages/core
npm install
- name: Build
run: |
cd packages/core
npm run build
- name: Release npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/core
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm run release