11---
22
3- name : CI
4-
53on : # yamllint disable-line rule:truthy
64 push :
75 branches :
@@ -15,34 +13,43 @@ on: # yamllint disable-line rule:truthy
1513 types :
1614 - ' created'
1715 schedule :
18- # Every Sunday at 05:10
19- - cron : ' 10 5 * * 0'
16+ # Every Tuesday at 03:10
17+ - cron : ' 10 5 * * 2'
18+
19+ name : 🔍 Continuous integration
2020
2121jobs :
2222 build :
23- name : Build
2423 runs-on : ubuntu-latest
2524 strategy :
2625 fail-fast : false
2726 matrix :
2827 os_name : ['alpine']
2928 steps :
30- -
uses :
e1himself/[email protected] 29+ - name : 📦 Install goss
30+ 3131
32- - name : Checkout
33- 32+ - name : 📦 Check out the codebase
33+ uses : actions/checkout@v3
34+ with :
35+ fetch-depth : 0
3436
35- - name : Set Environment Variables
37+ - name : 🌎 Set environment variables
3638 env :
3739 IMAGE_NAMESPACE : wayofdev/build-deps
3840 TEMPLATE : ${{ matrix.os_name }}
3941 run : |
40- export RELEASE_VERSION=${GITHUB_REF#refs/*/}
41- echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}" >> $GITHUB_ENV
42- echo "TEMPLATE=${TEMPLATE}" >> $GITHUB_ENV
43- echo "VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
42+ export RELEASE_VERSION="${GITHUB_REF#refs/*/}" \
43+ && { \
44+ echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}"; \
45+ echo "TEMPLATE=${TEMPLATE}"; \
46+ echo "VERSION=${RELEASE_VERSION:1}"; \
47+ } >> "$GITHUB_ENV"
48+
49+ - name : 🤖 Generate dist files
50+ run : make generate
4451
45- - name : Docker Meta
52+ - name : 🐳 Define docker meta
4653 id : meta
4754 uses : docker/metadata-action@v4
4855 with :
@@ -56,46 +63,50 @@ jobs:
5663 latest=false
5764 prefix=${{ matrix.os_name }}-
5865
59- - name : Login to DockerHub
66+ - name : 🔑 Login to docker-hub
6067 if : github.event_name != 'pull_request'
6168 uses : docker/login-action@v2
6269 with :
6370 username : ${{ secrets.DOCKER_USERNAME }}
6471 password : ${{ secrets.DOCKER_TOKEN }}
6572
6673 # ## For Cross Platform OSX builds uncomment these lines
67- - name : Set up QEMU
68- uses : docker/setup-qemu-action@v2
74+ - name : 🖥️ Set up QEMU
75+ uses : docker/setup-qemu-action@v2.1.0
6976 with :
7077 platforms : arm64
7178
72- - name : Set up Docker Buildx
79+ - name : 🚀 Set up Docker BuildX
7380 uses : docker/setup-buildx-action@v2
7481 with :
7582 install : true
7683
77- - name : Build and Export to Docker
78- uses : docker/build-push-action@v3
84+ - name : 🏷️ Set tag for docker release image
85+ if : success() && startsWith(github.ref, 'refs/tags/')
86+ run : |
87+ echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }}" >> "$GITHUB_ENV"
88+
89+ - name : 🏷️ Set tag for docker master image
90+ if : success() && ! startsWith(github.ref, 'refs/tags/')
91+ run : |
92+ echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest" >> "$GITHUB_ENV"
93+
94+ - name : 🛠️ Build and export to docker
95+ uses : docker/build-push-action@v4
7996 with :
8097 context : ./dist/${{ env.TEMPLATE }}
8198 load : true
8299 tags : ${{ steps.meta.outputs.tags }}
83- cache-from : type=registry,ref=${{ env.IMAGE_TAG }}
100+ cache-from : type=registry,ref=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest
84101 cache-to : type=inline
85102 labels : ${{ steps.meta.outputs.labels }}
86103
87- - name : Test Docker Release Image
88- if : success() && startsWith(github.ref, 'refs/tags/')
89- run : |
90- IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }} make test
91-
92- - name : Test Docker Master Image
93- if : success() && ! startsWith(github.ref, 'refs/tags/')
104+ - name : 🧪 Test docker image
94105 run : |
95- IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest make test
106+ export IMAGE_TAG=${{ env.IMAGE_TAG }}; make test
96107
97- - name : Push Docker Image
98- uses : docker/build-push-action@v3
108+ - name : 📤 Push docker image
109+ uses : docker/build-push-action@v4
99110 with :
100111 context : ./dist/${{ env.TEMPLATE }}
101112 # ## For Cross Platform OSX builds uncomment these lines
0 commit comments