-
Notifications
You must be signed in to change notification settings - Fork 772
149 lines (133 loc) · 4.51 KB
/
ci.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
139
140
141
142
143
144
145
146
147
148
149
name: cyclops-CI
on:
workflow_dispatch:
inputs:
version:
required: true
description: Version to be used as release name and image tagging
permissions:
contents: write
jobs:
test-UI:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
- name: Install dependencies
run: |
cd ${{ github.workspace }}/cyclops-ui
npm install --force
- name: Run tests
run: |
cd ${{ github.workspace }}/cyclops-ui
npm test
test-controller:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Unit tests
run: |
cd ${{ github.workspace }}/cyclops-ctrl
make unit-test
build-UI:
needs:
- test-UI
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:cyclops-ui"
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.event.inputs.version }}
push: true
tags: cyclopsui/cyclops-ui:${{ github.event.inputs.version }}
build-controller:
needs:
- test-controller
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:cyclops-ctrl"
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.event.inputs.version }}
push: true
tags: cyclopsui/cyclops-ctrl:${{ github.event.inputs.version }}
update-install-manifest:
needs:
- build-UI
- build-controller
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: update install manifest
run: |
TAG=${{ github.event.inputs.version }}
INSTALL_YAML=$GITHUB_WORKSPACE/install/cyclops-install.yaml
sed -i 's/cyclopsui\/cyclops-ctrl\:.*/cyclopsui\/cyclops-ctrl\:'$TAG'/' $INSTALL_YAML
sed -i 's/cyclopsui\/cyclops-ui\:.*/cyclopsui\/cyclops-ui\:'$TAG'/' $INSTALL_YAML
# update file
git fetch origin ${{ steps.extract_branch.outputs.branch }}
git checkout ${{ steps.extract_branch.outputs.branch }}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git status
git add $INSTALL_YAML
git commit -m '⚙️ update cyclops to '$TAG
git push origin HEAD:${{ steps.extract_branch.outputs.branch }}
release:
needs:
- update-install-manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ steps.extract_branch.outputs.branch }}" = "main" ]; then
gh release create ${{ github.event.inputs.version }} \
--repo="https://github.com/cyclops-ui/cyclops" \
--title="${{ github.event.inputs.version }}" \
--generate-notes
else
gh release create ${{ github.event.inputs.version }} \
--repo="https://github.com/cyclops-ui/cyclops" \
--title="${{ github.event.inputs.version }}" \
--generate-notes \
--target ${{ steps.extract_branch.outputs.branch }}\
--prerelease
fi