-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (138 loc) · 4.42 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
name: Release
permissions:
contents: write
on:
# release:
# types:
# - published
# - prereleased
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
BIN_NAME: tidy-borwser
PROJECT_NAME: tidy-borwser
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
# files: |
# ${{ env.BIN_NAME }}-*.zip
generate_release_notes: true
check-if-bin:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install jql
uses: taiki-e/install-action@v2
with:
tool: jql
- name: Searching for bin
id: searching
run: |
result=$(cargo metadata --format-version=1 --no-deps | jql '"packages"|>"targets"<|[1]|>"kind"' | jql '..' -i);
echo "targets=$result" >> "$GITHUB_OUTPUT";
echo kind of targets "$result";
- name: print if skip upploading binaries to github release
if: ${{ !contains(steps.searching.outputs.targets, 'bin') }}
run: echo "This job avoid publishing binaries to github releases for libraries crates"
outputs:
is_bin: ${{ contains(steps.searching.outputs.targets, 'bin') }}
build:
needs: [create-release, check-if-bin]
if: ${{ needs.check-if-bin.outputs.is_bin == 'true' }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
build-tool: cargo
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: false
build-tool: cargo
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
features: cross
build-tool: cross
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
features: cross
build-tool: cross
- os: macos-latest
target: x86_64-apple-darwin
cross: false
build-tool: cargo
- os: macos-latest
target: aarch64-apple-darwin
cross: false
build-tool: cargo
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
build-tool: cargo
- os: windows-latest
target: x86_64-pc-windows-gnu
cross: true
build-tool: cargo
- os: windows-latest
target: aarch64-pc-windows-msvc
cross: false
build-tool: cargo
name: ${{ matrix.target }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get sha-commit from tag
id: get_baseline_sha
shell: bash
run: |
latest_sha=$(git rev-list --tags --max-count=1)
echo "sha_tag=$latest_sha" >> "$GITHUB_OUTPUT";
# - name: Install dbus
# if: ${{ !matrix.cross && startsWith(matrix.os, 'ubuntu-') }}
# run: sudo apt update && sudo apt install libdbus-1-dev pkg-config
- name: Checkout source code to specific tag
uses: actions/checkout@v4
with:
ref: ${{ steps.get_baseline_sha.outputs.sha_tag }}
- name: Install Nightly Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: ${{ matrix.cross }}
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- uses: taiki-e/install-action@v2
if: ${{ matrix.cross }}
with:
tool: cross
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: ${{ env.BIN_NAME }}
features: ${{ matrix.features || '' }}
# build-tool: ${{ matrix.build-tool }}
target: ${{ matrix.target }}
# include: attribution
archive: $bin-$tag-$target
token: ${{ secrets.GITHUB_TOKEN }}
# ref: refs/tags/${{ needs.get-version.outputs.tag_version }}
checksum: sha256