-
Notifications
You must be signed in to change notification settings - Fork 6
99 lines (97 loc) · 3.32 KB
/
release.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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]'
jobs:
create_release:
name: Create GitHub release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- id: get_version
# $GITHUB_REF will have a value like "refs/tags/0.3.1". Extract "0.3.1" from it
run: echo "::set-output name=version::${GITHUB_REF##refs/tags/}"
- 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: ${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
upload:
name: Upload binary
needs: [create_release]
strategy:
fail-fast: false
matrix:
build: [linux-64, linux-32, mac, win-64, win-32]
include:
- build: linux-64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: linux-32
os: ubuntu-latest
target: i686-unknown-linux-gnu
- build: mac
os: macos-latest
target: x86_64-apple-darwin
- build: win-64
os: windows-latest
target: x86_64-pc-windows-msvc
- build: win-32
os: windows-latest
target: i686-pc-windows-msvc
runs-on: ${{ matrix.os }}
env:
ASSET_DIR: git-brws-${{ needs.create_release.outputs.version }}-${{ matrix.target }}
ZIP_FILE: git-brws-${{ needs.create_release.outputs.version }}-${{ matrix.target }}.zip
steps:
- name: Install dependencies on 32bit Linux
if: matrix.build == 'linux-32'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-7-multilib lib32gcc-7-dev libssl-dev:i386
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --color always --target=${{ matrix.target }} --verbose
env:
PKG_CONFIG_ALLOW_CROSS: 1
RUST_BACKTRACE: 1
- name: Archive files
if: matrix.build == 'linux-64' || matrix.build == 'linux-32' || matrix.build == 'mac'
run: |
mkdir $ASSET_DIR
cp target/${{ matrix.target }}/release/git-brws LICENSE.txt README.md git-brws.1 $ASSET_DIR
zip $ZIP_FILE -r $ASSET_DIR
- name: Archive files
if: matrix.build == 'win-64' || matrix.build == 'win-32'
shell: bash
run: |
mkdir $ASSET_DIR
cp target/${{ matrix.target }}/release/git-brws.exe LICENSE.txt README.md git-brws.1 $ASSET_DIR
7z a $ZIP_FILE $ASSET_DIR
- 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: $ZIP_FILE
asset_name: $ZIP_FILE
asset_content_type: application/zip