-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (139 loc) · 4.76 KB
/
make-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
on:
push:
tags:
- v*
permissions:
contents: write
name: make-release
jobs:
makerelease:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
name: make release
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/[email protected]'
with:
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: zooapi
- name: Install latest nightly
uses: dtolnay/rust-toolchain@stable
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Install deps
shell: bash
run: |
./.github/workflows/cross-deps.sh
- if: ${{ matrix.os == 'macos-latest' }}
name: Install deps
shell: bash
run: |
brew install \
coreutils \
jq
cargo install toml-cli
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run make cross
run: |
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
make release
ls -la cross
shell: bash
- name: move files to dir for upload
shell: bash
run: |
export VERSION=v$(toml get Cargo.toml package.version | jq -r .)
mkdir -p releases/$(basename $(pwd))
cp -r cross releases/$(basename $(pwd))/${VERSION}
cp cross/README.md cross/${{matrix.os}}-${{github.ref_name}}-README.md
- name: 'upload binary files'
id: upload-files
uses: google-github-actions/[email protected]
with:
path: releases
destination: dl.zoo.io
# Store the binary artifacts for retrival later.
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}-${{github.ref_name}}
path: ./cross
# Store the readme as an artifact so we can combine the two.
- name: Archive the README.md data
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}-${{github.ref_name}}-README.md
path: ${{github.workspace}}/cross/${{matrix.os}}-${{github.ref_name}}-README.md
createrelease:
runs-on: ubuntu-latest
needs: [makerelease]
name: createrelease
steps:
- uses: actions/checkout@v4
- name: Install latest nightly
uses: dtolnay/rust-toolchain@stable
- uses: actions/download-artifact@v4
with:
name: release-macos-latest-${{github.ref_name}}
path: build
- uses: actions/download-artifact@v4
with:
name: release-ubuntu-latest-${{github.ref_name}}
path: build
- uses: actions/download-artifact@v4
with:
name: ubuntu-latest-${{github.ref_name}}-README.md
- uses: actions/download-artifact@v4
with:
name: macos-latest-${{github.ref_name}}-README.md
- name: combine readmes
shell: bash
run: |
ls -la
echo 'These instructions are meant as an easy way to install. Note: you likely need to install `coreutils` in order to have the `sha256sum` command.' > release.md
echo "" >> release.md
cat macos-latest-${{github.ref_name}}-README.md \
ubuntu-latest-${{github.ref_name}}-README.md \
>> release.md
rm build/*-README.md
rm build/README.md
- name: Get if prerelease
shell: bash
id: extract_prerelease
run: |
cargo install toml-cli
export VERSION=v$(toml get Cargo.toml package.version | jq -r .)
if echo $VERSION | grep -q "rc"; then
echo "##[set-output name=prerelease;]$(echo true)";
else
if echo $VERSION | grep -q "pre"; then
echo "##[set-output name=prerelease;]$(echo true)";
else
echo "##[set-output name=prerelease;]$(echo false)";
fi
fi
- name: Create a Release
uses: softprops/action-gh-release@v2
with:
body_path: ${{github.workspace}}/release.md
prerelease: ${{steps.extract_prerelease.outputs.prerelease}}
files: ./build/*