-
Notifications
You must be signed in to change notification settings - Fork 15
141 lines (133 loc) · 5.71 KB
/
publish-binaries.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
name: "Publish binaries"
on:
push:
branches: ["main"]
tags:
- "v*"
jobs:
bump_dev_release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'bytecodealliance/wasm-pkg-tools'
name: Create dev release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Login GH CLI
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- name: Delete old dev release
run: gh release delete -R bytecodealliance/wasm-pkg-tools dev -y || true
- name: Create new latest release
run: gh release create -R bytecodealliance/wasm-pkg-tools dev --prerelease --notes "Published artifacts from the latest build"
publish_dev_release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'bytecodealliance/wasm-pkg-tools'
name: Publish to dev release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- rust-target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- rust-target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- rust-target: x86_64-apple-darwin
os: macos-latest
- rust-target: aarch64-apple-darwin
os: macos-latest
- rust-target: x86_64-pc-windows-gnu
os: windows-latest
needs:
- bump_dev_release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }}
- run: cargo build --release --target ${{ matrix.rust-target }}
if: ${{ ! matrix.cross }}
- run: cargo install cross
if: ${{ matrix.cross }}
- run: cross build --release --target ${{ matrix.rust-target }}
if: ${{ matrix.cross }}
- run: mv ./target/${{ matrix.rust-target }}/release/wkg.exe ./target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
if: matrix.os == 'windows-latest'
- run: mv ./target/${{ matrix.rust-target }}/release/wkg ./target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
if: matrix.os != 'windows-latest'
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release upload -R bytecodealliance/wasm-pkg-tools --clobber dev target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
create_tagged_release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'bytecodealliance/wasm-pkg-tools'
name: Create tagged release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release create -R bytecodealliance/wasm-pkg-tools ${{ github.ref_name }}
publish_tagged_release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'bytecodealliance/wasm-pkg-tools'
name: Publish to tagged release
runs-on: ${{ matrix.os }}
needs:
- create_tagged_release
strategy:
matrix:
include:
- rust-target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- rust-target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- rust-target: x86_64-apple-darwin
os: macos-latest
- rust-target: aarch64-apple-darwin
os: macos-latest
- rust-target: x86_64-pc-windows-gnu
os: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }}
- run: cargo build --release --target ${{ matrix.rust-target }}
if: ${{ ! matrix.cross }}
- run: cargo install cross
if: ${{ matrix.cross }}
- run: cross build --release --target ${{ matrix.rust-target }}
if: ${{ matrix.cross }}
- run: mv ./target/${{ matrix.rust-target }}/release/wkg.exe ./target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
if: matrix.os == 'windows-latest'
- run: mv ./target/${{ matrix.rust-target }}/release/wkg ./target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
if: matrix.os != 'windows-latest'
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release upload -R bytecodealliance/wasm-pkg-tools --clobber ${{ github.ref_name }} target/${{ matrix.rust-target }}/release/wkg-${{ matrix.rust-target }}
publish_crates:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'bytecodealliance/wasm-pkg-tools'
name: Publish to crates.io
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: Publish wasm-pkg-common
working-directory: ./crates/wasm-pkg-common
run: cargo publish
- name: Publish wasm-pkg-client
working-directory: ./crates/wasm-pkg-client
run: cargo publish
- name: Publish wasm-pkg-core
working-directory: ./crates/wasm-pkg-core
run: cargo publish
- name: Publish wkg
working-directory: ./crates/wkg
run: cargo publish