-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.73 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
name: Build Docker Image
on:
push:
branches:
- main
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: jerray/[email protected]
with:
aliyun-cli-version: "3.0.183"
mode: AK
access-key-id: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
region: cn-beijing
- id: aliyun-cr-token
name: Obtain Aliyun Container Registry credentials
run: |
aliyun cr --force --version 2016-06-07 GET /tokens > cr_token.json
TOKEN=$(jq -r '.data.authorizationToken' cr_token.json)
echo "::add-mask::$TOKEN"
echo "json<<EOF" >> $GITHUB_OUTPUT
cat cr_token.json >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
rm -f cr_token.json
- name: Login to Aliyun Container Registry
uses: docker/login-action@v2
with:
registry: registry.cn-beijing.aliyuncs.com
username: ${{ fromJson(steps.aliyun-cr-token.outputs.json).data.tempUserName }}
password: ${{ fromJson(steps.aliyun-cr-token.outputs.json).data.authorizationToken }}
- name: Build and push Image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
VITE_API_URL=${{ secrets.API_URL }}
VITE_ANALYTICS_CF_TOKEN=${{ secrets.CF_ANALYTICS_TOKEN }}
push: true
tags: |
registry.cn-beijing.aliyuncs.com/jingbh/bjut-su-appeal:frontend
cache-from: type=gha
cache-to: type=gha,mode=max