-
Notifications
You must be signed in to change notification settings - Fork 28
190 lines (175 loc) · 6.21 KB
/
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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
prepare-darwin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache darwin
uses: actions/cache@v3
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- name: Run GoReleaser
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=darwin -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/bruin-data/goreleaser-cross-pro:v1.22 release --clean --split --verbose
prepare-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: cache linux
uses: actions/cache@v3
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- name: Run GoReleaser
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=linux -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/bruin-data/goreleaser-cross-pro:v1.22 release --clean --split --verbose
release-unix:
runs-on: ubuntu-latest
needs: [prepare-linux, prepare-darwin]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- uses: actions/cache@v3
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: v2.3.2
args: continue --merge
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
release-windows:
runs-on: windows-latest
needs: [prepare-linux, prepare-darwin]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: v2.3.2
distribution: goreleaser-pro
args: release --clean --split
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
VERSION: ${{ github.ref_name }}
COMMIT_SHA: ${{ github.sha }}
GGOOS: windows
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/windows/bruin_Windows_x86_64.zip
asset_name: bruin_Windows_x86_64.zip
tag: ${{ github.ref }}
overwrite: false
make_latest: false
prerelease: false
install-windows:
runs-on: windows-latest
name: Installer Script on Windows
needs: [release-windows, release-unix]
steps:
- uses: actions/checkout@v3
- name: Use install script
shell: bash
run: curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh -s -- -d ${GITHUB_REF##*/}
- name: Test Pipeline
shell: bash
run: /c/Users/runneradmin/.local/bin/bruin.exe init duckdb test-pipeline && cd test-pipeline && git init && /c/Users/runneradmin/.local/bin/bruin.exe run .
install-unix:
runs-on: ubuntu-latest
name: Installer Script on Linux
needs: [release-windows, release-unix]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract tag from ref
id: extract_tag
run: |
ref_name="${GITHUB_REF##*/}"
echo "tag=${ref_name}" >> $GITHUB_ENV
- name: Use install script
run: curl -LsSf https://raw.githubusercontent.com/bruin-data/bruin/refs/heads/main/install.sh | sh -s -- -d ${{ env.tag }}
- name: Test Pipeline
run: bruin init duckdb test-pipeline && cd test-pipeline && git init && bruin run .
release:
runs-on: ubuntu-latest
needs: [install-unix, install-windows]
steps:
- uses: actions/checkout@v3
- name: Extract tag from ref
id: extract_tag
run: |
ref_name="${GITHUB_REF##*/}"
echo "tag=${ref_name}" >> $GITHUB_ENV
- name: Release promote to latest
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.tag }}
prerelease: false
make_latest: true
clear_attachments: false