-
Notifications
You must be signed in to change notification settings - Fork 36
169 lines (154 loc) · 5.54 KB
/
tembo_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
name: Github release for the repo
permissions:
contents: write
on:
push:
branches:
- bump-homebrew-formula
paths:
- 'tembo-cli/Cargo.toml'
jobs:
gh_release:
name: Github Release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
asset_name: x86_64-apple
os: macos-latest
executable: tembo
- target: aarch64-apple-darwin
asset_name: aarch64-apple
os: macos-latest
executable: tembo
- target: x86_64-unknown-linux-musl
asset_name: x86_64-linux
os: ubuntu-20.04
container: quay.io/tembo/muslrust:1.76.0-stable
executable: tembo
- target: aarch64-unknown-linux-musl
asset_name: aarch64-linux
os: ubuntu-20.04
container: messense/rust-musl-cross:aarch64-musl
executable: tembo
- target: x86_64-pc-windows-msvc
asset_name: x86_64-windows
os: windows-latest
executable: tembo.exe
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.cli_version_mac.outputs.version }}
release_version: ${{ steps.set_release_version.outputs.release_version }}
container:
image: ${{ matrix.container }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Install Deps Ubuntu
id: install_deps_ubuntu
run: |
set -x
apt update -y
apt install pkg-config libssl-dev -y
if: runner.os == 'Linux'
- name: Cargo build
working-directory: ./tembo-cli
id: cargo_build
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target=${{ matrix.target }}
cd target/${{ matrix.target }}/release
tar -czvf tembo.tar.gz ${{ matrix.executable }}
git config --global --add safe.directory '*'
# TODO: Figure out a better way to fetch version for mac & linux
- name: CLI version Mac
working-directory: ./tembo-cli
id: cli_version_mac
run: |
cargo install cargo-get
VERSION=$(cargo-get package.version)
TEMBO_CLI_NAME=$(cargo-get package.name)-$VERSION
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
if: runner.os == 'macOS'
- name: CLI version Linux
working-directory: ./tembo-cli
id: cli_version_linux
run: |
set -x
PKG_VERSION=$(awk -F ' = ' '$$1 ~ /version/ { gsub(/[\\"]/, "", $$2); printf("%s",$$2); exit; }' Cargo.toml)
TEMBO_VERSION=${PKG_VERSION#"version = "}
TEMBO_CLI_NAME=tembo-cli-${TEMBO_VERSION}
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $GITHUB_ENV
if: runner.os == 'Linux'
- name: CLI version Windows
working-directory: ./tembo-cli
id: cli_version_windows
run: |
$TEMBO_VERSION = $(target/${{ matrix.target }}/release/tembo.exe --version)
$TEMBO_CLI_NAME = $TEMBO_VERSION.replace(' ','-')
echo "TEMBO_CLI_NAME=$TEMBO_CLI_NAME" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: "Generate release changelog"
id: changelog
uses: mikepenz/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: set env non-windows
id: set_release_version
run: |
release_version=$(date +'%Y.%m.%d')
echo "NOW=$release_version" >> $GITHUB_ENV
echo "release_version=$release_version" >> $GITHUB_OUTPUT
if: runner.os != 'Windows'
- name: set env windows
run: echo "NOW=$(date +'%Y.%m.%d')" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tembo-cli/target/${{ matrix.target }}/release/tembo.tar.gz
asset_name: ${{ env.TEMBO_CLI_NAME }}-${{ matrix.asset_name }}.tar.gz
prerelease: true
tag: ${{ env.NOW }}
body: ${{ steps.changelog.outputs.changelog }}
post_gh_release:
runs-on: macos-latest
needs: [gh_release]
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
repository: tembo-io/homebrew-tembo
ssh-key: ${{ secrets.SERVICE_USER_GITHUB_SSH_KEY }}
path: homebrew-tembo
- name: Git commit and push to remote
shell: bash
run: |
set -xe
cd homebrew-tembo
git config --global user.name "coredb-service-user"
git config --global user.email "[email protected]"
git fetch origin test-bump && git checkout test-bump || git checkout -b test-bump
- name: Replace version
shell: bash
run: |
set -xe
sed -E -i '' 's/version ".*/version "${{needs.gh_release.outputs.version}}"/g' tembo-cli.rb
- name: Replace release_version
shell: bash
run: |
set -xe
sed -E -i '' 's/release_version =.*/release_version = "${{needs.gh_release.outputs.release_version}}"/g' tembo-cli.rb
- name: Git commit and push to remote
shell: bash
run: |
set -xe
cd homebrew-tembo
git add --all
# debugging
git diff HEAD
git commit -m "Update from tembo-io/tembo: ${{ inputs.version }}"
git push origin test-bump