-
Notifications
You must be signed in to change notification settings - Fork 24
137 lines (117 loc) · 3.68 KB
/
build.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
name: Build Binaries
on:
workflow_dispatch:
inputs:
debug:
description: enable tmate debug
default: false
type: boolean
push:
paths:
- "src/**"
- "Cargo.toml"
- "build.rs"
- ".github/workflows/build.yml"
branches: [ main ]
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- name: "Windows"
id: win
os: ubuntu-latest
executable: 'geode.exe'
prebuild: 'sudo apt-get install gcc-mingw-w64-x86-64'
target: x86_64-pc-windows-gnu
- name: "macOS"
id: mac
os: macos-latest
executable: 'geode'
prebuild: |
brew fetch --force --bottle-tag=ventura openssl@3
brew reinstall $(brew --cache --bottle-tag=ventura openssl@3)
export OPENSSL_STATIC=1
export OPENSSL_DIR="/opt/homebrew/opt/openssl@3"
target: x86_64-apple-darwin
- name: "Linux"
id: linux
os: ubuntu-latest
executable: 'geode'
# some stupid old ubuntu versions cant install libssl3
prebuild: 'export OPENSSL_STATIC=1'
target: x86_64-unknown-linux-gnu
name: Build ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.config.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.id }}
- name: Build
run: |
${{ matrix.config.prebuild }}
cargo build --release --target ${{ matrix.config.target }}
- name: Move to output folder
shell: bash
run: |
mkdir ./out
mv ./target/${{ matrix.config.target }}/release/${{ matrix.config.executable }} ./out
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: geode-cli-${{ matrix.config.id }}
path: ./out/
- name: Setup tmate session
if: ${{ failure() && inputs.debug && matrix.config.id == 'mac' }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
publish:
name: Publish
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Declare Version Variables
id: ref
run: |
echo "version=$(cat VERSION | xargs)" >> $GITHUB_OUTPUT
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts
# TODO: change when this is fixed https://github.com/actions/download-artifact/issues/143
- name: Zip Windows Artifacts
uses: vimtor/[email protected]
with:
files: artifacts/geode-cli-win/geode.exe
dest: artifacts/geode-cli-${{ steps.ref.outputs.hash }}-win.zip
- name: Zip macOS Artifacts
uses: vimtor/[email protected]
with:
files: artifacts/geode-cli-mac/geode
dest: artifacts/geode-cli-${{ steps.ref.outputs.hash }}-mac.zip
- name: Zip Linux Artifacts
uses: vimtor/[email protected]
with:
files: artifacts/geode-cli-linux/geode
dest: artifacts/geode-cli-${{ steps.ref.outputs.hash }}-linux.zip
- name: Update Development Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Development Release'
body: Geode CLI development release for commit ${{ github.sha }}.
files: |
./artifacts/*.zip