@@ -3,14 +3,23 @@ name: "[Dispatch] Release"
33on :
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 : 1.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
1119env :
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
1524jobs :
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 }} =~ ^v[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/action-slack@v3.2.0
@@ -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 github-actions@github.com
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 :
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/action-slack@v3.2.0
@@ -93,29 +102,43 @@ 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 }}
125+
126+ - name : Build and push to pyengine
127+ uses : docker/build-push-action@v4
128+ with :
129+ context : .
130+ platform : ${{ env.ARCH }}
131+ push : true
132+ tags : pyengine/${{ env.SERVICE }}:${{ env.VERSION }}
133+
111134 - name : Build and push to spaceone
112- uses : docker/build-push-action@v1
135+ uses : docker/build-push-action@v4
113136 with :
114- path : .
115- repository : spaceone/ ${{ env.SERVICE }}
116- username : ${{ secrets.DOCKER_USERNAME }}
117- password : ${{ secrets.DOCKER_PASSWORD }}
118- tags : ${{ env.VERSION }}
137+ context : .
138+ platform : ${{ env.ARCH }}
139+ push : true
140+ tags : spaceone/ ${{ env.SERVICE }}:${{ env.VERSION }}
141+
119142 - name : Notice when job fails
120143 if : failure()
121144 uses : 8398a7/action-slack@v3.2.0
0 commit comments