generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 47
63 lines (62 loc) · 2.44 KB
/
build-and-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
name: Meshsync Build and Releaser
on:
push:
branches:
- 'master'
tags:
- 'v*'
jobs:
build:
name: Build check
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@main
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@main
with:
go-version: '1.21'
check-latest: 'true'
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build -o meshery-meshsync .
docker:
name: Docker build and push
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@main
with:
fetch-depth: 1
- name: Setup go
uses: actions/setup-go@main
with:
go-version: '1.21'
check-latest: 'true'
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker edge build & tag
if: startsWith(github.ref, 'refs/tags/') != true && success()
run: |
DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:edge-latest --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg GIT_VERSION="edge-latest" .
docker tag ${{ secrets.IMAGE_NAME }}:edge-latest ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7}
- name: Docker edge push
if: startsWith(github.ref, 'refs/tags/') != true && success()
run: |
docker push ${{ secrets.IMAGE_NAME }}:edge-latest
docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7}
- name: Docker stable build & tag
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
run: |
DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:stable-latest --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg GIT_VERSION=${GITHUB_REF/refs\/tags\//} .
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7}
- name: Docker stable push
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
run: |
docker push ${{ secrets.IMAGE_NAME }}:stable-latest
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7}