@@ -3,14 +3,23 @@ name: "[Dispatch] Release"
3
3
on :
4
4
workflow_dispatch :
5
5
inputs :
6
- tag :
6
+ version :
7
7
description : ' enter version(x.y.z)'
8
8
required : true
9
- default : v1.0.0
9
+ default : ' 2.0.0'
10
+ container_arch :
11
+ type : choice
12
+ description : ' choose container architecture'
13
+ default : linux/amd64,linux/arm64
14
+ options :
15
+ - " linux/amd64"
16
+ - " linux/amd64,linux/arm64"
17
+
10
18
11
19
env :
12
- TAG : ${{ github.event.inputs.tag }}
13
- SLACK_WEBHOOK_URL : ${{secrets.SLACK_WEBHOOK_URL}}
20
+ VERSION : ${{ github.event.inputs.version }}
21
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
22
+ ARCH : ${{ github.event.inputs.container_arch }}
14
23
15
24
jobs :
16
25
owner_check :
@@ -25,16 +34,16 @@ jobs:
25
34
steps :
26
35
- name : check version format
27
36
run : |
28
- if [[ !(${{ env.TAG }} =~ ^v [0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]$) ]];
37
+ if [[ !(${{ env.VERSION }} =~ ^[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]$) ]];
29
38
then
30
39
echo "You entered an incorrect version format."
31
40
exit 1
32
41
fi
33
42
- name : debugging
34
43
run : |
35
- echo "major=$(echo ${{env.TAG }} | cut -c 2- | cut -d'.' -f1)"
36
- echo "minor=$(echo ${{env.TAG }} | cut -c 2- | cut -d'.' -f2)"
37
- echo "patch=$(echo ${{env.TAG }} | cut -c 2- | cut -d'.' -f3)"
44
+ echo "major=$(echo ${{env.VERSION }} | cut -c 2- | cut -d'.' -f1)"
45
+ echo "minor=$(echo ${{env.VERSION }} | cut -c 2- | cut -d'.' -f2)"
46
+ echo "patch=$(echo ${{env.VERSION }} | cut -c 2- | cut -d'.' -f3)"
38
47
- name : notice when job fails
39
48
if : failure()
40
49
@@ -52,11 +61,11 @@ jobs:
52
61
token : ${{ secrets.PAT_TOKEN }}
53
62
- name : update version file # That is used where the master_push actions
54
63
run : |
55
- echo ${{ env.TAG }} > src/VERSION
64
+ echo ${{ env.VERSION }} > src/VERSION
56
65
git config user.name github-actions
57
66
git config user.email [email protected]
58
67
git add .
59
- git commit -m "[CI/CD] release version ${{ env.TAG }}"
68
+ git commit -m "[CI/CD] release version ${{ env.VERSION }}"
60
69
- name : push changes
61
70
uses : ad-m/github-push-action@master
62
71
with :
79
88
token : ${{ secrets.PAT_TOKEN }}
80
89
- name : git tagging
81
90
run : |
82
- git tag ${{ env.TAG }}
83
- git push origin "${{ env.TAG }}"
91
+ git tag ${{ env.VERSION }}
92
+ git push origin "${{ env.VERSION }}"
84
93
- name : notice when job fails
85
94
if : failure()
86
95
@@ -93,29 +102,49 @@ jobs:
93
102
needs : tagging
94
103
runs-on : ubuntu-latest
95
104
steps :
96
- - uses : actions/checkout@v2
97
- - name : get version
98
- run : |
99
- echo "VERSION=$(echo ${{ env.TAG }} | cut -c 2-)" >> $GITHUB_ENV
105
+ - name : Checkout
106
+ uses : actions/checkout@v3
107
+ with :
108
+ token : ${{ secrets.PAT_TOKEN }}
109
+
100
110
- name : get service name
101
111
run : |
102
112
echo "SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2)" >> $GITHUB_ENV
103
- - name : Build and push to pyengine
104
- uses : docker/build-push-action@v1
113
+
114
+ - name : Set up QEMU
115
+ uses : docker/setup-qemu-action@v2
116
+
117
+ - name : Set up Docker Buildx
118
+ uses : docker/setup-buildx-action@v2
119
+
120
+ - name : Login to Docker Hub
121
+ uses : docker/login-action@v2
105
122
with :
106
- path : .
107
- repository : pyengine/${{ env.SERVICE }}
108
123
username : ${{ secrets.DOCKER_USERNAME }}
109
124
password : ${{ secrets.DOCKER_PASSWORD }}
110
- tags : ${{ env.VERSION }}
111
- - name : Build and push to spaceone
112
- uses : docker/build-push-action@v1
125
+
126
+ - name : Build and push to pyengine
127
+ uses : docker/build-push-action@v4
113
128
with :
114
- path : .
115
- repository : spaceone/${{ env.SERVICE }}
116
- username : ${{ secrets.DOCKER_USERNAME }}
117
- password : ${{ secrets.DOCKER_PASSWORD }}
118
- tags : ${{ env.VERSION }}
129
+ context : .
130
+ platforms : ${{ env.ARCH }}
131
+ push : true
132
+ tags : pyengine/${{ env.SERVICE }}:${{ env.VERSION }}
133
+
134
+ - name : Login to Docker Hub
135
+ uses : docker/login-action@v2
136
+ with :
137
+ username : ${{ secrets.CLOUDFORET_DEV_DOCKER_USERNAME }}
138
+ password : ${{ secrets.CLOUDFORET_DEV_DOCKER_PASSWORD }}
139
+
140
+ - name : Build and push to cloudforet
141
+ uses : docker/build-push-action@v4
142
+ with :
143
+ context : .
144
+ platforms : ${{ env.ARCH }}
145
+ push : true
146
+ tags : cloudforet/${{ env.SERVICE }}:${{ env.VERSION }}
147
+
119
148
- name : Notice when job fails
120
149
if : failure()
121
150
@@ -134,4 +163,4 @@ jobs:
134
163
with :
135
164
status : ${{job.status}}
136
165
fields : repo,message,commit,author,action,ref,workflow,job
137
- author_name : Github Action Slack
166
+ author_name : Github Action Slack
0 commit comments