This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 222
118 lines (103 loc) · 3.86 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
name: Release
on:
push:
tags:
- "v*"
env:
RUST_BACKTRACE: full
jobs:
release:
name: Create release
permissions: write-all
runs-on: ubuntu-latest
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
release_version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Get release version
id: get_version
uses: battila7/get-version-action@v2
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: Release ${{ steps.get_version.outputs.version }}
draft: true
prerelease: false
build-unix:
name: Build ${{ matrix.job.os }} (${{ matrix.job.target }})
permissions: write-all
runs-on: ${{ matrix.job.os }}
needs: release
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest, name: linux-i686, target: i686-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-latest, name: linux-x86_64, target: x86_64-unknown-linux-gnu }
- { os: macos-latest, name: darwin-x86_64, target: x86_64-apple-darwin }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.job.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --locked --package rinha --target=${{ matrix.job.target }}
- name: Strip debug information
run: strip target/${{ matrix.job.target }}/release/rinha
- name: Archive
run: tar czf rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.tar.gz -C target/${{ matrix.job.target }}/release rinha
- name: Upload release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release_upload_url }}
asset_path: rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.tar.gz
asset_name: rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.tar.gz
asset_content_type: application/octet-stream
build-win:
name: Build Windows (${{ matrix.job.target }})
permissions: write-all
runs-on: windows-latest
needs: release
strategy:
fail-fast: false
matrix:
job:
- { os: windows-latest, name: windows-i686, target: i686-pc-windows-msvc }
- { os: windows-latest, name: windows-x86_64, target: x86_64-pc-windows-msvc }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.job.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --package rinha --target=${{ matrix.job.target }}
- name: Archive
run: 7z -y a rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.exe.zip target/${{ matrix.job.target }}/release/rinha.exe
- name: Upload release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release_upload_url }}
asset_path: rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.exe.zip
asset_name: rinha-${{ needs.release.outputs.release_version }}-${{ matrix.job.name }}.exe.zip
asset_content_type: application/zip