-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (70 loc) · 2.65 KB
/
release.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
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
on:
push:
branches:
- master
- development
tags:
- v*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Setup Environment Variables For Build Process
id: current_version
run: |
box install stachebox --production
echo "VERSION=`cat modules/stachebox/box.json | jq '.version' -r`" >> $GITHUB_ENV
box package set version=@build.version@+@build.number@
# main or snapshot
echo "Github Ref is $GITHUB_REF"
echo "BRANCH=main" >> $GITHUB_ENV
if [ $GITHUB_REF == 'refs/heads/development' ]
then
echo "BRANCH=development" >> $GITHUB_ENV
fi
- name: Setup Builds
id: setup
env:
DOCKER_IMAGE: ortussolutions/stachebox
run: |
# Tag Builds
if [[ $GITHUB_REF == refs/tags/* ]]; then
BUILD_IMAGE_TAG="${GITHUB_REF#refs/tags/v}"
elif [[ $GITHUB_REF == 'refs/heads/development' ]]; then
# Snapshot builds
BUILD_IMAGE_TAG=snapshot
VERSION_TAG = snapshot-${{ env.VERSION }}
else
BUILD_IMAGE_TAG=latest
VERSION_TAG=${{ env.VERSION }}
fi
TAGS="${DOCKER_IMAGE}:${BUILD_IMAGE_TAG},${DOCKER_IMAGE}:${VERSION_TAG}"
# Set output parameters.
echo "IMAGE_TAG=${TAGS}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: DockerHub Login
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Stachebox Image
uses: docker/build-push-action@v4
env:
DOCKER_BUILDKIT: 1
with:
provenance: false
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ env.IMAGE_TAG }}