-
-
Notifications
You must be signed in to change notification settings - Fork 9
208 lines (192 loc) · 9.59 KB
/
release.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release
on:
push:
branches:
- master
- staging
- 'release/**'
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v1
- name: Use Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Fix node-gyp (Windows Only)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
npm install -g node-gyp
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: NPM Install
run: |
corepack enable
npm run bootstrap
- name: Find Version
run: |
echo "GIT_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: Make GitHub Release
if: ${{ github.ref == 'refs/heads/master' }}
run: |
CHANGELOG=$(./script/most_recent_changelog.sh)
node ./src/make-github-release/bin/make-github-release.js release --owner "${{ github.repository_owner }}" --repo "${{ github.event.repository.name }}" --text "${CHANGELOG}" --auth "${{ secrets.GITHUB_TOKEN }}"
- name: Test
run: |
npx --node-options="--max_old_space_size=4096" jest --detectOpenHandles --forceExit --no-cache
- name: Build
run: |
npm run build
- name: Publish Master NPM Packages
if: ${{ github.ref == 'refs/heads/master' }}
run: |
npm whoami
echo "Publishing NPM Packages..."
ls -la
npx lerna publish from-package --yes --no-verify-access
echo "Updating package-lock.json..."
# Sleep for 5 seconds to hopefully give NPM time to update the package listing
sleep 5
cd ./src/aux-server
for i in {1..5}; do
npm install --package-lock-only && break || sleep 5;
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Alpha NPM Packages
if: ${{ github.ref != 'refs/heads/master' }}
run: |
npm whoami
echo "Publishing NPM Packages..."
ls -la
npx lerna publish from-package --yes --no-verify-access --canary
echo "Updating package-lock.json..."
# Sleep for 5 seconds to hopefully give NPM time to update the package listing
sleep 5
cd ./src/aux-server
for i in {1..5}; do
npm install --package-lock-only && break || sleep 5;
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Docs
if: ${{ github.ref == 'refs/heads/master' }}
run: |
cd docs
echo "Upgrading Casual Simulation NPM Packages.."
pnpm upgrade "@casual-simulation/" --latest
git config --global user.name DevOps
git config --global user.email [email protected]
git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_SECRET }}@github.com/${{ github.repository }}
echo "Building and deploying..."
GIT_USER="DevOps" GIT_PASS="${{ secrets.DEPLOY_SECRET }}" npm run deploy
- name: Build Docker
run: |
echo "Building..."
docker build -t "casualsimulation/aux:${{ env.GIT_TAG }}" -t "casualsimulation/aux:latest" -t "casualsimulation/aux:alpha" .
docker build -t "casualsimulation/aux-proxy:${{ env.GIT_TAG }}" -t "casualsimulation/aux-proxy:latest" -t "casualsimulation/aux-proxy:alpha" ./src/aux-proxy
docker build -t "casualsimulation/aux-redirector:${{ env.GIT_TAG }}" -t "casualsimulation/aux-redirector:latest" -t "casualsimulation/aux-redirector:alpha" ./src/aux-redirector
- name: Login to DockerHub
run: |
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Publish DockerHub
run: |
echo "Publishing the x64 Docker Image...."
docker push casualsimulation/aux:${{ env.GIT_TAG }}
docker push casualsimulation/aux-proxy:${{ env.GIT_TAG }}
docker push casualsimulation/aux-redirector:${{ env.GIT_TAG }}
- name: Publish DockerHub Latest
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publishing the latest tags...."
docker push casualsimulation/aux:latest
docker push casualsimulation/aux-proxy:latest
docker push casualsimulation/aux-redirector:latest
- name: Publish DockerHub Alpha
if: ${{ github.ref != 'refs/heads/master' }}
run: |
echo "Publishing the alpha tags...."
docker push casualsimulation/aux:alpha
docker push casualsimulation/aux-proxy:alpha
docker push casualsimulation/aux-redirector:alpha
- name: Login to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set GHCR Environment Variables
run: |
echo "Publishing the x64 Docker Image...."
CASUALOS_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos
CASUALOS_IMAGE_ID=$(echo $CASUALOS_IMAGE_ID | tr '[A-Z]' '[a-z]')
PROXY_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos-proxy
PROXY_IMAGE_ID=$(echo $PROXY_IMAGE_ID | tr '[A-Z]' '[a-z]')
REDIRECTOR_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos-redirector
REDIRECTOR_IMAGE_ID=$(echo $REDIRECTOR_IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:${{ env.GIT_TAG }}
docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:${{ env.GIT_TAG }}
docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:${{ env.GIT_TAG }}
docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:latest
docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:latest
docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:latest
docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:alpha
docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:alpha
docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:alpha
echo "CASUALOS_IMAGE_ID=$CASUALOS_IMAGE_ID" >> $GITHUB_ENV
echo "PROXY_IMAGE_ID=$PROXY_IMAGE_ID" >> $GITHUB_ENV
echo "REDIRECTOR_IMAGE_ID=$REDIRECTOR_IMAGE_ID" >> $GITHUB_ENV
- name: Publish GHCR
run: |
docker push $CASUALOS_IMAGE_ID:${{ env.GIT_TAG }}
docker push $PROXY_IMAGE_ID:${{ env.GIT_TAG }}
docker push $REDIRECTOR_IMAGE_ID:${{ env.GIT_TAG }}
- name: Publish GHCR Latest
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "Publishing the latest tags...."
docker push $CASUALOS_IMAGE_ID:latest
docker push $PROXY_IMAGE_ID:latest
docker push $REDIRECTOR_IMAGE_ID:latest
- name: Publish GHCR Alpha
if: ${{ github.ref != 'refs/heads/master' }}
run: |
echo "Publishing the alpha tags...."
docker push $CASUALOS_IMAGE_ID:alpha
docker push $PROXY_IMAGE_ID:alpha
docker push $REDIRECTOR_IMAGE_ID:alpha
arm32:
name: ARM32 Docker Build
needs: build
runs-on: ubuntu-latest
if: false
steps:
- 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: us-east-1
- name: Run CodeBuild
uses: aws-actions/[email protected]
with:
project-name: publish-casualos-docker-arm32
disable-github-env-vars: true
arm64:
name: ARM64 Docker Build
needs: build
runs-on: ubuntu-latest
steps:
- 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: us-east-1
- name: Run CodeBuild
uses: aws-actions/[email protected]
with:
project-name: publish-casualos-docker-arm64
disable-github-env-vars: true