-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (106 loc) · 3.53 KB
/
release.yml
File metadata and controls
122 lines (106 loc) · 3.53 KB
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
name: Release
on:
push:
tags:
- 'v*.*.*'
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
build-binaries:
name: Build Release Binaries
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: html_view_app
asset_name: html_view_app-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: html_view_app
asset_name: html_view_app-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: html_view_app
asset_name: html_view_app-macos-aarch64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: html_view_app.exe
asset_name: html_view_app-windows-x86_64.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libjavascriptcoregtk-4.1-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
working-directory: html_view_app
- name: Strip binary (Linux/macOS)
if: runner.os != 'Windows'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream
publish-crates:
name: Publish to crates.io
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libjavascriptcoregtk-4.1-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Publish html_view_shared
run: cargo publish --token ${{ secrets.CARGO_TOKEN }}
working-directory: html_view_shared
continue-on-error: true # May already be published
- name: Wait for crates.io index update
run: sleep 30
- name: Publish html_view
run: cargo publish --token ${{ secrets.CARGO_TOKEN }}
working-directory: html_view