Skip to content

Commit 7d92102

Browse files
committed
Build release artifacts for additional targets
1 parent d954218 commit 7d92102

File tree

2 files changed

+105
-58
lines changed

2 files changed

+105
-58
lines changed

.github/workflows/package.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runs_on:
7+
required: true
8+
type: string
9+
target:
10+
required: true
11+
type: string
12+
extension:
13+
default: ""
14+
type: string
15+
16+
jobs:
17+
build:
18+
name: Build static binaries
19+
runs-on: ${{ inputs.runs_on }}
20+
21+
steps:
22+
- name: build dependencies
23+
if: ${{ inputs.runs_on == 'ubuntu-latest' }}
24+
run: |
25+
sudo apt-get install musl-tools libudev-dev
26+
27+
- uses: actions/checkout@v2
28+
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: stable
32+
target: ${{ inputs.target }}
33+
34+
- uses: Swatinem/rust-cache@v1
35+
36+
- uses: actions-rs/cargo@v1
37+
with:
38+
command: build
39+
args: --release --all --target ${{ inputs.target }}
40+
41+
- uses: papeloto/action-zip@v1
42+
with:
43+
files: target/${{ inputs.target }}/release/espflash${{ inputs.extension }}
44+
recursive: true
45+
dest: espflash-${{ inputs.target }}.zip
46+
47+
- uses: papeloto/action-zip@v1
48+
with:
49+
files: target/${{ inputs.target }}/release/cargo-espflash${{ inputs.extension }}
50+
recursive: true
51+
dest: cargo-espflash-${{ inputs.target }}.zip
52+
53+
- uses: svenstaro/upload-release-action@v2
54+
with:
55+
repo_token: ${{ secrets.GITHUB_TOKEN }}
56+
file: espflash-${{ inputs.target }}.zip
57+
tag: ${{ github.ref }}
58+
59+
- uses: svenstaro/upload-release-action@v2
60+
with:
61+
repo_token: ${{ secrets.GITHUB_TOKEN }}
62+
file: cargo-espflash-${{ inputs.target }}.zip
63+
tag: ${{ github.ref }}

.github/workflows/release.yml

Lines changed: 42 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,50 @@
1-
name: Release
2-
31
on:
42
release:
53
types: [created]
64

5+
name: Release
6+
77
jobs:
8-
build:
9-
name: Build Static Linux Binaries
10-
runs-on: ubuntu-latest
8+
# Linux
9+
10+
x86_64-unknown-linux-gnu:
11+
uses: ./.github/workflows/package.yml
12+
with:
13+
runs_on: ubuntu-latest
14+
target: x86_64-unknown-linux-gnu
15+
16+
x86_64-unknown-linux-musl:
17+
uses: ./.github/workflows/package.yml
18+
with:
19+
runs_on: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
22+
# macOS
23+
24+
aarch64-apple-darwin:
25+
uses: ./.github/workflows/package.yml
26+
with:
27+
runs_on: macos-latest
28+
target: aarch64-apple-darwin
29+
30+
x86_64-apple-darwin:
31+
uses: ./.github/workflows/package.yml
32+
with:
33+
runs_on: macos-latest
34+
target: x86_64-apple-darwin
1135

12-
steps:
13-
- name: build dependencies
14-
run: |
15-
sudo apt-get install musl-tools libudev-dev
16-
- uses: actions/checkout@v2
17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
toolchain: stable
20-
target: x86_64-unknown-linux-musl
21-
- uses: Swatinem/rust-cache@v1
22-
- uses: actions-rs/cargo@v1
23-
with:
24-
command: build
25-
args: --release --all --target x86_64-unknown-linux-musl
26-
- uses: svenstaro/upload-release-action@v2
27-
with:
28-
repo_token: ${{ secrets.GITHUB_TOKEN }}
29-
file: target/x86_64-unknown-linux-musl/release/espflash
30-
asset_name: espflash
31-
tag: ${{ github.ref }}
32-
- uses: svenstaro/upload-release-action@v2
33-
with:
34-
repo_token: ${{ secrets.GITHUB_TOKEN }}
35-
file: target/x86_64-unknown-linux-musl/release/cargo-espflash
36-
asset_name: cargo-espflash
37-
tag: ${{ github.ref }}
36+
# Windows
3837

39-
build-windows:
40-
name: Build Static Windows Binaries
41-
runs-on: ubuntu-latest
38+
x86_64-pc-windows-gnu:
39+
uses: ./.github/workflows/package.yml
40+
with:
41+
runs_on: windows-latest
42+
target: x86_64-pc-windows-gnu
43+
extension: .exe
4244

43-
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions-rs/toolchain@v1
46-
with:
47-
toolchain: stable
48-
target: x86_64-pc-windows-gnu
49-
- uses: Swatinem/rust-cache@v1
50-
- uses: actions-rs/cargo@v1
51-
with:
52-
use-cross: true
53-
command: build
54-
args: --release --all --target x86_64-pc-windows-gnu
55-
- uses: svenstaro/upload-release-action@v2
56-
with:
57-
repo_token: ${{ secrets.GITHUB_TOKEN }}
58-
file: target/x86_64-pc-windows-gnu/release/espflash.exe
59-
asset_name: espflash.exe
60-
tag: ${{ github.ref }}
61-
- uses: svenstaro/upload-release-action@v2
62-
with:
63-
repo_token: ${{ secrets.GITHUB_TOKEN }}
64-
file: target/x86_64-pc-windows-gnu/release/cargo-espflash.exe
65-
asset_name: cargo-espflash.exe
66-
tag: ${{ github.ref }}
45+
x86_64-pc-windows-msvc:
46+
uses: ./.github/workflows/package.yml
47+
with:
48+
runs_on: windows-latest
49+
target: x86_64-pc-windows-msvc
50+
extension: .exe

0 commit comments

Comments
 (0)