Skip to content

Commit 2c8a28f

Browse files
committed
build: update release workflow
1 parent f25e15f commit 2c8a28f

File tree

1 file changed

+58
-29
lines changed

1 file changed

+58
-29
lines changed

.github/workflows/dispatch_release.yaml

+58-29
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ name: "[Dispatch] Release"
33
on:
44
workflow_dispatch:
55
inputs:
6-
tag:
6+
version:
77
description: 'enter version(x.y.z)'
88
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+
1018

1119
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 }}
1423

1524
jobs:
1625
owner_check:
@@ -25,16 +34,16 @@ jobs:
2534
steps:
2635
- name: check version format
2736
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]$) ]];
2938
then
3039
echo "You entered an incorrect version format."
3140
exit 1
3241
fi
3342
- name: debugging
3443
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)"
3847
- name: notice when job fails
3948
if: failure()
4049
uses: 8398a7/[email protected]
@@ -52,11 +61,11 @@ jobs:
5261
token: ${{ secrets.PAT_TOKEN }}
5362
- name: update version file # That is used where the master_push actions
5463
run: |
55-
echo ${{ env.TAG }} > src/VERSION
64+
echo ${{ env.VERSION }} > src/VERSION
5665
git config user.name github-actions
5766
git config user.email [email protected]
5867
git add .
59-
git commit -m "[CI/CD] release version ${{ env.TAG }}"
68+
git commit -m "[CI/CD] release version ${{ env.VERSION }}"
6069
- name: push changes
6170
uses: ad-m/github-push-action@master
6271
with:
@@ -79,8 +88,8 @@ jobs:
7988
token: ${{ secrets.PAT_TOKEN }}
8089
- name: git tagging
8190
run: |
82-
git tag ${{ env.TAG }}
83-
git push origin "${{ env.TAG }}"
91+
git tag ${{ env.VERSION }}
92+
git push origin "${{ env.VERSION }}"
8493
- name: notice when job fails
8594
if: failure()
8695
uses: 8398a7/[email protected]
@@ -93,29 +102,49 @@ jobs:
93102
needs: tagging
94103
runs-on: ubuntu-latest
95104
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+
100110
- name: get service name
101111
run: |
102112
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
105122
with:
106-
path: .
107-
repository: pyengine/${{ env.SERVICE }}
108123
username: ${{ secrets.DOCKER_USERNAME }}
109124
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
113128
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+
119148
- name: Notice when job fails
120149
if: failure()
121150
uses: 8398a7/[email protected]
@@ -134,4 +163,4 @@ jobs:
134163
with:
135164
status: ${{job.status}}
136165
fields: repo,message,commit,author,action,ref,workflow,job
137-
author_name: Github Action Slack
166+
author_name: Github Action Slack

0 commit comments

Comments
 (0)