-
Notifications
You must be signed in to change notification settings - Fork 36
82 lines (65 loc) · 2.44 KB
/
release.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Release
on:
release:
types: [published]
# workflow_dispatch:
# reason_to_run:
# description: "Please provide a description why it's need to be run outside of automatic builds process"
# required: false
# default: ""
env:
IMAGE: cluster.dev
REGISTRY: docker.io/clusterdev
jobs:
release:
name: Release bin version
runs-on: ubuntu-latest
# if: github.event_name != 'workflow_dispatch'
container: golang:1.20.2-alpine
steps:
- name: Install make
run: apk add make bash jq curl git
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Release
run: |
git config --global --add safe.directory /__w/cluster.dev/cluster.dev
git fetch --prune --unshallow --tags
./scripts/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
push:
name: Release docker image
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v2
- name: Build image
run: |
set -x
VERSION=$(git describe --tag --abbrev=0)
cp Dockerfile-alpine Dockerfile
docker build -t ${IMAGE}:${VERSION}-alpine .
docker tag ${IMAGE}:${VERSION}-alpine ${REGISTRY}/${IMAGE}:${VERSION}-alpine
cp Dockerfile-debian Dockerfile
docker build -t ${REGISTRY}/${IMAGE}:${VERSION}-debian --build-arg CDEV_VERSION=${VERSION}-alpine .
cp Dockerfile-full Dockerfile
docker build -t ${IMAGE} --build-arg CDEV_VERSION=${VERSION}-alpine .
docker tag "${IMAGE}" "${REGISTRY}/${IMAGE}:${VERSION}"
docker tag "${IMAGE}" "${REGISTRY}/${IMAGE}:latest"
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username "${{ secrets.DOCKER_USER }}" --password "${{ secrets.DOCKER_PASS }}"
- name: Push image for release
run: |
VERSION=$(git describe --tag --abbrev=0)
echo IMAGE=${IMAGE}
echo VERSION=${VERSION}
docker push "$REGISTRY/$IMAGE:$VERSION-alpine"
docker push "${REGISTRY}/${IMAGE}:${VERSION}-debian"
docker push "${REGISTRY}/${IMAGE}:${VERSION}"
docker push "${REGISTRY}/${IMAGE}:latest"
# - name: Message why this build was required
# if: github.event.inputs.reason_to_run
# run: echo "Reason for the manual build: ${{ github.event.inputs.reason_to_run }}"