-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (63 loc) · 1.98 KB
/
cd.yaml
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
58
59
60
61
62
63
64
65
66
name: Continuous Deployment
on:
push:
branches:
- master
tags:
- v0.*
- v1.*
jobs:
dockerpublish:
name: Docker build and push latest
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare variables - version and tags
id: prep
run: |
DOCKER_IMAGE=natmorris/iocontrollergw
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo ::set-output name=version::${VERSION}
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
- name: Replace version variable in __init__.py
id: replace_version
run: |
echo ${{ steps.prep.outputs.version }}
sed -i "s/^__VERSION__.*/__VERSION__ = \"${{ steps.prep.outputs.version }}\"/" ioctlgw/__init__.py
- name: Multi platform build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
tags: ${{ steps.prep.outputs.tags }}
deploydocs:
name: Deploy docs
needs: dockerpublish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}