forked from nuclio/nuclio
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (119 loc) · 4.2 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 2017 The Nuclio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Release
on:
release:
types:
- created
# Run Release on push to development for unstable
push:
branches:
- development
env:
REPO: quay.io
REPO_NAME: nuclio
jobs:
release:
name: Release ${{ matrix.arch }}
runs-on: ubuntu-latest
if: github.repository == 'nuclio/nuclio'
strategy:
fail-fast: false
matrix:
arch: [ arm64, amd64 ]
steps:
- name: Dump github context
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Dump runner context
run: echo "$RUNNER_CONTEXT"
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
- name: Dump github ref
run: echo "$GITHUB_REF"
- name: Extract ref info
id: release_info
run: |
echo ::set-output name=REF_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=REF_TAG::${GITHUB_REF#refs/tags/}
- name: Set NUCLIO_LABEL to unstable
if: github.event_name == 'push' && steps.release_info.outputs.REF_BRANCH == 'development'
run: |
echo "NUCLIO_LABEL=unstable" >> $GITHUB_ENV
- name: Set NUCLIO_LABEL to release tag
if: github.event_name == 'release'
run: |
echo "NUCLIO_LABEL=${{ steps.release_info.outputs.REF_TAG }}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.17"
# since github-actions gives us 14G only, and fills it up with some garbage
# we will free up some space for us (~2GB)
- name: Freeing up disk space
run: |
chmod +x "${GITHUB_WORKSPACE}/hack/scripts/ci/free-space.sh"
"${GITHUB_WORKSPACE}/hack/scripts/ci/free-space.sh"
- uses: azure/docker-login@v1
with:
login-server: ${{ env.REPO }}
username: ${{ secrets.QUAYIO_DOCKER_USERNAME }}
password: ${{ secrets.QUAYIO_DOCKER_PASSWORD }}
# for none x86_64 platforms
- name: Install QEMU
if: matrix.arch != 'amd64'
run: |
# install os packages
sudo apt update -qqy && sudo apt -qqy install qemu qemu-user-static
# enabled non arm64 docker containers executables
# mirrored to gcr.io/iguazio from multiarch/qemu-user-static:latest for availability reasons
docker run --rm --privileged gcr.io/iguazio/multiarch/qemu-user-static:latest --reset -p yes
- name: Build
run: make docker-images
env:
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }}
NUCLIO_ARCH: ${{ matrix.arch }}
- name: Push images
run: |
make push-docker-images
env:
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }}
NUCLIO_ARCH: ${{ matrix.arch }}
- name: Tag and push stable images
if: env.NUCLIO_LABEL != 'unstable'
run: |
docker tag "$NUCLIO_DOCKER_REPO/dashboard:$NUCLIO_LABEL-$NUCLIO_ARCH" "$NUCLIO_DOCKER_REPO/dashboard:stable-$NUCLIO_ARCH"
docker push "$NUCLIO_DOCKER_REPO/dashboard:stable-$NUCLIO_ARCH"
env:
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }}
NUCLIO_ARCH: ${{ matrix.arch }}
- name: Build binaries
run: |
NUCLIO_OS=linux make tools
if [ $NUCLIO_ARCH == "amd64" ]; then \
NUCLIO_OS=darwin make tools; \
NUCLIO_OS=windows make tools; \
fi;
env:
NUCLIO_NUCTL_CREATE_SYMLINK: false
GOPATH: /home/runner/go
NUCLIO_ARCH: ${{ matrix.arch }}
- name: Upload binaries
uses: AButler/[email protected]
if: github.event_name == 'release'
with:
files: '/home/runner/go/bin/nuctl-*'
repo-token: ${{ secrets.GITHUB_TOKEN }}