-
Notifications
You must be signed in to change notification settings - Fork 110
132 lines (107 loc) · 3.88 KB
/
build.yml
File metadata and controls
132 lines (107 loc) · 3.88 KB
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
name: Build
on:
push:
branches: [develop]
tags-ignore:
- "**"
pull_request:
branches: [develop]
release:
types: [published]
jobs:
Verify:
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/go
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set Go version
id: go_version
run: |
GO_VERSION=$(sed -E -n '/^go / s/^go ([0-9]+\.[0-9]+)(\.[0-9]+)?$/\1/p' < go.mod)
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ steps.go_version.outputs.version }}
- name: Cache Godel assets
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.godel
key: ${{ runner.os }}-godel-${{ hashFiles('godelw', 'godel/config/godel.yml') }}
restore-keys: |
${{ runner.os }}-godel-
- name: Verify
run: ./godelw verify --apply=false
Dist:
runs-on: ubuntu-latest
permissions:
contents: write
env:
GOPATH: /home/runner/go
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set Go version
id: go_version
run: |
GO_VERSION=$(sed -E -n '/^go / s/^go ([0-9]+\.[0-9]+)(\.[0-9]+)?$/\1/p' < go.mod)
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ steps.go_version.outputs.version }}
- name: Cache Godel assets
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.godel
key: ${{ runner.os }}-godel-${{ hashFiles('godelw', 'godel/config/godel.yml') }}
restore-keys: |
${{ runner.os }}-godel-
- name: Build distribution
run: ./godelw dist
- name: Build Docker image
run: ./godelw docker build --verbose
- name: Archive distribution
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: dist
path: |
build/bulldozer/*/bin/*.tgz
#
# Steps after this point should only run when publishing
# Include them here to avoid exporting the Docker container as an artifact
#
- name: Login to Docker Hub
if: ${{ github.event_name == 'push' || github.event_name == 'release' }}
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push snapshot image to Docker Hub
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
run: ./godelw docker push --tags=snapshot
- name: Push release image to Docker Hub
if: ${{ github.event_name == 'release' }}
run: ./godelw docker push --tags=latest,version
- name: Publish release assets
if: ${{ github.event_name == 'release' }}
run: ./godelw publish github --add-v-prefix --api-url=${GITHUB_API_URL} --user=palantir --repository=bulldozer --token=${{ secrets.GITHUB_TOKEN }}
ci-all:
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
needs:
- Verify
- Dist
steps:
- name: Check required job results
run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" == "true" ]]; then
echo "One or more required jobs did not succeed"
echo '${{ toJSON(needs) }}'
exit 1
fi
echo "All required jobs succeeded"