-
Notifications
You must be signed in to change notification settings - Fork 191
85 lines (82 loc) · 2.64 KB
/
github-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
name: Publish Release
on:
push:
tags:
- 'v*'
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 100
submodules: true
- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Generate Changelog
id: changelog
run: |
prev_tag=$(git describe --abbrev=0 --tags ${{ github.ref }}^)
log=$(git log --oneline --decorate=no $prev_tag..${{ github.ref }})
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=value::$log"
- name: Create 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 }}
body: ${{ steps.changelog.outputs.value }}
draft: false
prerelease: false
build-release:
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
targets: ${{ matrix.target }}
- name: Install Musl
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
sudo apt-get install -y musl-tools
cat << 'EOF' | sudo tee /usr/bin/cross
#!/bin/sh
cargo $@
EOF
sudo chmod +x /usr/bin/cross
- name: Install Cross
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' }}
run: cargo install cross
- name: Build
run: |
find ./locales -name '*.toml' -printf '%P\0' | while IFS=\n read -r -d '' file
do
export LOCALE=${file%.toml}
cross build --release --target=${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/rssbot rssbot-$LOCALE-${{ matrix.target }}
cross build --release --target=${{ matrix.target }} --no-default-features --features=native-tls
mv ./target/${{ matrix.target }}/release/rssbot rssbot-$LOCALE-${{ matrix.target }}-openssl
done
- name: Upload Release Asset
id: upload-release-asset
uses: iovxw/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_files: "rssbot-*"