-
Notifications
You must be signed in to change notification settings - Fork 26
161 lines (136 loc) · 4.65 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
name: Release
on:
push:
tags: ["*"]
env:
OPENSSL_VER: openssl-1.1.1n
jobs:
windows:
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: Build release binary
run: cargo build --verbose --locked --release
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-win64
path: target/release/foreman.exe
macos-x86-64:
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v1
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup target install aarch64-apple-darwin
rustup target install x86_64-apple-darwin
- name: Build x86_64 release binary
run: |
source $HOME/.cargo/env
cargo build --verbose --locked --release --target x86_64-apple-darwin
- name: Upload Intel (x86_64) artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-macos-x86_64
path: target/x86_64-apple-darwin/release/foreman
macos-arm64:
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v1
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup target install aarch64-apple-darwin
rustup target install x86_64-apple-darwin
- name: Cache OpenSSL
uses: actions/cache@v2
with:
path: |
${{ env.OPENSSL_VER }}-install
key: ${{ env.OPENSSL_VER }}-darwin-arm64-static
- name: Build arm64 release binary
run: |
source $HOME/.cargo/env
source .github/workflows/openssl.sh
cargo build --verbose --locked --release --target aarch64-apple-darwin
- name: Upload arm64 artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-macos-arm64
path: target/aarch64-apple-darwin/release/foreman
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: Build
run: cargo build --locked --verbose --release
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-linux
path: target/release/foreman
release:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: ["windows", "macos-x86-64", "macos-arm64", "linux"]
steps:
- uses: actions/checkout@v1
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- run: |
zip -rj foreman-win64.zip ./artifacts/foreman-win64/*
zip -rj foreman-macos-x86_64.zip ./artifacts/foreman-macos-x86_64/*
zip -rj foreman-macos-arm64.zip ./artifacts/foreman-macos-arm64/*
zip -rj foreman-linux.zip ./artifacts/foreman-linux/*
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- name: Upload windows build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./foreman-win64.zip
asset_name: foreman-win64.zip
asset_content_type: application/zip
- name: Upload macos build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./foreman-macos-x86_64.zip
asset_name: foreman-macos-x86_64.zip
asset_content_type: application/zip
- name: Upload macos build (arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./foreman-macos-arm64.zip
asset_name: foreman-macos-arm64.zip
asset_content_type: application/zip
- name: Upload linux build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./foreman-linux.zip
asset_name: foreman-linux.zip
asset_content_type: application/zip