-
-
Notifications
You must be signed in to change notification settings - Fork 34
102 lines (85 loc) · 3.7 KB
/
build-release-binaries.yaml
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
name: "ci-build-release-binaries"
on:
release:
types: [created]
jobs:
build_binaries:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive_ext: tgz
- target: x86_64-apple-darwin
os: macos-latest
archive_ext: tgz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive_ext: zip
runs-on: ${{ matrix.os }}
steps:
- name: checkout_tagged_commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
- name: set_output
id: set_output
shell: bash
run: |
echo "archive=cargo-msrv-${{ matrix.target }}-${{ github.event.release.tag_name }}.${{ matrix.archive_ext }}" >> $GITHUB_OUTPUT
echo "subfolder=cargo-msrv-${{ matrix.target }}-${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
- name: show_outputs
shell: bash
run: |
echo "Archive: '${{ steps.set_output.outputs.archive }}'"
echo "Subfolder: '${{ steps.set_output.outputs.subfolder }}'"
- name: create_pkg_subfolder
shell: bash
run: mkdir ${{ steps.set_output.outputs.subfolder }}
- name: copy_files_to_pkg_subfolder
shell: bash
run: |
cp LICENSE-APACHE ${{ steps.set_output.outputs.subfolder }}
cp LICENSE-MIT ${{ steps.set_output.outputs.subfolder }}
cp README.md ${{ steps.set_output.outputs.subfolder }}
- name: install_rust
uses: dtolnay/rust-toolchain@stable
- name: build_${{ matrix.target }}_release_binary
shell: bash
run: cargo build --target=${{ matrix.target }} --release
- name: install_cargo_about
shell: bash
# Tempory workaround for cargo-about issue https://github.com/EmbarkStudios/cargo-about/issues/237, which has been fixed, but where
# the fix has not been released yet.
run: cargo install cargo-about --git https://github.com/EmbarkStudios/cargo-about.git --rev a4296450258de52c728ddfb33fd8769be91d31e7
- name: generate_dep_licenses_file
shell: bash
run: cargo about generate --output-file "${{ steps.set_output.outputs.subfolder }}/third-party-licenses.html" about.hbs
- name: pack_archive_macos
if: matrix.os == 'macos-latest'
shell: bash
run: |
cp ./target/${{ matrix.target }}/release/cargo-msrv ${{ steps.set_output.outputs.subfolder }}
gtar --create --gzip --file=${{ steps.set_output.outputs.archive }} ${{ steps.set_output.outputs.subfolder }}
- name: pack_archive_linux
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
cp target/${{ matrix.target }}/release/cargo-msrv ${{ steps.set_output.outputs.subfolder }}
tar --create --gzip --file=${{ steps.set_output.outputs.archive }} ${{ steps.set_output.outputs.subfolder }}
- name: pack_archive_windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
cp target/${{ matrix.target }}/release/cargo-msrv.exe ./${{ steps.set_output.outputs.subfolder }}
7z a -tzip ${{ steps.set_output.outputs.archive }} ${{ steps.set_output.outputs.subfolder }}
- name: upload_artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.set_output.outputs.archive }}
asset_name: ${{ steps.set_output.outputs.archive }}
asset_content_type: application/gzip