-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (60 loc) · 2.17 KB
/
main.yml
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
name: Build Docker Image and Deploy
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Run on cron
schedule:
- cron: "35 22 */7 * *"
jobs:
Build_Publish_and_Deploy:
runs-on: ubuntu-latest
steps:
-
name: Checkout Code
uses: actions/checkout@v2
-
name: Prepare
id: prep
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=commit::sha-${GITHUB_SHA::8}
echo ::set-output name=created::$(date -u +'%Y%m%d')
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Login to Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.DOCKER_REG_URL }}
username: ${{ secrets.DOCKER_REG_USER }}
password: ${{ secrets.DOCKER_REG_PASS }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/arm64, linux/amd64, linux/arm/7
tags: ${{ secrets.DOCKER_REG_URL }}/phpipam:latest,${{ secrets.DOCKER_REG_URL }}/phpipam:${{ steps.prep.outputs.version }},${{ secrets.DOCKER_REG_URL }}/phpipam:${{ steps.prep.outputs.commit }},${{ secrets.DOCKER_REG_URL }}/phpipam:${{ steps.prep.outputs.created }}
# -
# name: Deploy Image
# uses: fjogeleit/http-request-action@master
# with:
# url: ${{ secrets.DOCKER_DEP_URL }}
# method: 'POST'