-
-
Notifications
You must be signed in to change notification settings - Fork 146
138 lines (130 loc) · 3.93 KB
/
cli-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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Leapp CLI 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
TEAM_REPOSITORY: ${{ secrets.TEAM_REPOSITORY }}
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 }}
- uses: actions/checkout@v3
if: ${{ env.TEAM_REPOSITORY != '' }}
with:
repository: ${{ env.TEAM_REPOSITORY }}
ref: main
token: ${{ secrets.GH_TOKEN }}
path: leapp-team
- name: Inject Team Feature
if: ${{ env.TEAM_REPOSITORY != '' }}
run: |
cd packages/core
npm install
npm run build
cd ../..
mv leapp-team ..
cd ../leapp-team/packages/leapp-team-core
npm run bootstrap
cd ../leapp-team-service
npm install
npm run test
npm run enable-team-features-prod
- name: Bootstrap
run: |
npm run bootstrap
- name: Build CLI
run: |
cd packages/cli
npm run prepack
- 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-cli
- name: Send badge to S3
shell: bash
run: |
cd coverage
aws s3 cp cli-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 "^cli-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: macos-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 run bootstrap
- name: Build CLI
run: |
cd packages/cli
npm run prepack
- name: Release npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/cli
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
npm run release-npm
- name: Release Homebrew
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GIT_PUSH_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }}
run: |
git config --global user.name "Noovolari Bot"
git config --global user.email "[email protected]"
cd packages/cli
npm run release-homebrew