-
Notifications
You must be signed in to change notification settings - Fork 128
147 lines (129 loc) · 4.95 KB
/
on-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
on:
release:
types:
- published
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Build for linux
run: |
docker run --rm \
--volume "${PWD}":/root/src \
--workdir /root/src \
joseluisq/rust-linux-darwin-builder:1.60.0 \
sh -c "cargo build --release"
- name: Prepare release
run: |
cd target/x86_64-unknown-linux-musl/release
EVENT_DATA=$(cat "$GITHUB_EVENT_PATH")
RELEASE_NAME=$(echo "$EVENT_DATA" | jq -r .release.tag_name)
FILE=replibyte_${RELEASE_NAME}_x86_64-unknown-linux-musl
sudo tar -czvf ${FILE}.tar.gz replibyte && sudo rm replibyte
sudo touch ${FILE}.tar.gz.sha256sum && sudo chmod 777 ${FILE}.tar.gz.sha256sum
sudo sha256sum "${FILE}.tar.gz" | cut -d ' ' -f 1 > ${FILE}.tar.gz.sha256sum
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/x86_64-unknown-linux-musl/release/replibyte_*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
target: x86_64-pc-windows-gnu
override: true
- name: Build for windows
run: |
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y g++-mingw-w64-x86-64
cargo build --all --release --target x86_64-pc-windows-gnu
- name: Prepare release
run: |
cd target/x86_64-pc-windows-gnu/release
EVENT_DATA=$(cat "$GITHUB_EVENT_PATH")
RELEASE_NAME=$(echo "$EVENT_DATA" | jq -r .release.tag_name)
FILE=replibyte_${RELEASE_NAME}_x86_64-pc-windows-gnu.exe
sudo zip -9r ${FILE}.zip replibyte.exe && sudo rm replibyte.exe
sudo touch ${FILE}.zip.sha256sum && sudo chmod 777 ${FILE}.zip.sha256sum
sudo sha256sum "${FILE}.zip" | cut -d ' ' -f 1 > ${FILE}.zip.sha256sum
- name: Release
uses: softprops/action-gh-release@v1
with:
files: target/x86_64-pc-windows-gnu/release/replibyte_*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-mac:
runs-on: ubuntu-latest
outputs:
sha256sum: ${{ steps.prep.outputs.sha256sum }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
default: true
override: true
- name: Build for mac
run: |
docker run --rm \
--volume "${PWD}":/root/src \
--workdir /root/src \
joseluisq/rust-linux-darwin-builder:1.60.0 \
sh -c "CC=o64-clang CXX=o64-clang++ cargo build --release --target x86_64-apple-darwin"
- id: prep
name: Prepare release
run: |
cd target/x86_64-apple-darwin/release
EVENT_DATA=$(cat "$GITHUB_EVENT_PATH")
RELEASE_NAME=$(echo "$EVENT_DATA" | jq -r .release.tag_name)
FILE=replibyte_${RELEASE_NAME}_x86_64-apple-darwin
sudo zip -9r ${FILE}.zip replibyte && sudo rm replibyte
sudo touch ${FILE}.zip.sha256sum && sudo chmod 777 ${FILE}.zip.sha256sum
CHECKSUM=$(sudo sha256sum "${FILE}.zip" | cut -d ' ' -f 1)
echo "${CHECKSUM}" > ${FILE}.zip.sha256sum
printf "::set-output name=%s::%s\n" sha256sum "${CHECKSUM}"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
target/x86_64-apple-darwin/release/replibyte_*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-on-homebrew:
runs-on: ubuntu-latest
needs: build-mac
steps:
- name: Extract version and sha256sum
id: extract
run: |
printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}"
printf "::set-output name=%s::%s\n" sha256sum "${{ needs.build-mac.outputs.sha256sum }}"
- uses: mislav/bump-homebrew-formula-action@v2
if: "!contains(github.ref, '-')" # skip prereleases
with:
formula-name: replibyte
homebrew-tap: Qovery/homebrew-replibyte
download-url: https://github.com/Qovery/replibyte/releases/download/${{ steps.extract.outputs.tag-name }}/replibyte_${{ steps.extract.outputs.tag-name }}_x86_64-apple-darwin.zip
download-sha256: ${{ steps.extract.outputs.sha256sum }}
env:
COMMITTER_TOKEN: ${{ secrets.PERSONAL_TOKEN }}