forked from buildpacks/lifecycle
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (113 loc) · 3.87 KB
/
build.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
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
name: build
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
jobs:
test-and-build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up go
uses: actions/setup-go@v2-beta
with:
go-version: '1.14'
- name: Set up go env
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- name: Install jq
run: |
mkdir -p deps/bin
curl -s -L -o deps/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x deps/bin/jq
echo "::add-path::${PWD}/deps/bin"
- name: Test
run: make test
- name: Build
run: |
make clean
make build-linux
make package-linux
- uses: actions/upload-artifact@v2
with:
name: lifecycle-linux-x86-64
path: out/lifecycle-v*+linux.x86-64.tgz
test-and-build-windows:
runs-on: windows-latest
steps:
- name: Set git to use LF and symlinks
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.symlinks true
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up go
uses: actions/setup-go@v2-beta
with:
go-version: '1.14'
- name: Install jq
run: choco install jq
- name: Test
run: make test
shell: cmd
- name: Build
run: |
make clean
make build-windows
make package-windows
shell: cmd
- uses: actions/upload-artifact@v2
with:
name: lifecycle-windows-x86-64
path: out/lifecycle-v*+windows.x86-64.tgz
create-lifecycle-image-manifest-list:
if: github.event_name == 'push'
needs:
- test-and-build-linux
- test-and-build-windows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up go
uses: actions/setup-go@v2-beta
with:
go-version: '1.14'
- name: Set up go env
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- name: Install jq
run: |
mkdir -p deps/bin
curl -s -L -o deps/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x deps/bin/jq
echo "::add-path::${PWD}/deps/bin"
- name: Download artifacts - linux
uses: actions/download-artifact@v1
with:
name: lifecycle-linux-x86-64
- name: Download artifacts - windows
uses: actions/download-artifact@v1
with:
name: lifecycle-windows-x86-64
- name: Publish linux and windows lifecycle images and create manifest list
run: |
if [[ ${{ github.event_name }} != 'push' ]]; then exit 0; fi
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
LIFECYCLE_IMAGE_TAG=$(git describe --always --dirty)
go run ./tools/image/main.go -lifecyclePath ./lifecycle-linux-x86-64/lifecycle-v*+linux.x86-64.tgz -tag yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux
go run ./tools/image/main.go -lifecyclePath ./lifecycle-windows-x86-64/lifecycle-v*+windows.x86-64.tgz -tag yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG}-windows -os windows
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG} yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG}-linux yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG}-windows
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push yaelharel/lifecycle:${LIFECYCLE_IMAGE_TAG}