-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (108 loc) · 4.18 KB
/
release-rust.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
name: "Rust Build & Release"
# This configuration largely comes from ripgrep
on:
push:
tags:
- 'v*'
env:
RUSTFLAGS: "-D warnings"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
build_release:
name: "Build ${{ matrix.build }} binaries (cargo build)"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# Unsuccessful compilation; try on local
# - build: linux-arm
# os: ubuntu-latest
# target: arm-unknown-linux-gnueabihf
# extension: ''
# - build: macos
# os: macos-latest
# target: x86_64-apple-darwin
# extension: ''
- build: windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
env:
CARGO: cargo
TARGET_DIR: ./target
TARGET_FLAGS: ""
MYSQLCLIENT_LIB_DIR: C:\mysql\lib
steps:
# Retreive git files
- uses: actions/checkout@v2
# Set cache configuration
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Show commands
run: |
echo pwd:
pwd
echo ls:
ls
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
- run: cargo build --release --verbose --target ${{ matrix.target }}
- name: Show output
run: |
ls target
ls "target/${{ matrix.target }}"
ls "target/${{ matrix.target }}/release"
# Create .zip or .tar.gz file
- name: Build archive
shell: bash
run: |
# outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
# outdir=target/release/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}${{ matrix.extension }}
# cargo_outdir="$(find "${{ env.TARGET_DIR }}" -name udfsuite-stamp -print0 | xargs -0 ls -t | head -n1 | xargs dirname)"
ref_name=${GITHUB_REF##*/}
# Remove leading 'v' for use where needed
ref_name_stripped=$(echo $ref_name | perl -0pe 's/^v//')
echo "Ref name: \"$ref_name\""
echo "Ref name stripped: \"$ref_name_stripped\""
staging="udfsuite-$ref_name-${{ matrix.target }}"
mkdir "$staging"
# Remove the "unreleased" section from our changelog
perl -0777 -i -pe "s/(<\!-- next-header -->.*## \[Unreleased\].*?\n)(?=## |<\!--)//gms" CHANGELOG.md
cp {README.md,LICENSE*,CHANGELOG.md} "$staging/"
# Build RNOTES.md, which we will use for our Github release (not shipped in zip)
# Select the release notes from our latest version only
perl -0777 -ne "print /(## \[$ref_name_stripped\].*?\n)(?=\n*^(?:## |<\!--))/gms" CHANGELOG.md > RNOTES.md
# Select the diff URL for this version only
perl -0777 -ne "print /\n\[$ref_name_stripped\]:.*?\n/gms" CHANGELOG.md >> RNOTES.md
echo "Release notes:" && cat RNOTES.md
echo Output:
ls "target/${{ matrix.target }}/release/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/${{ matrix.target }}/release/*.dll "$staging/"
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/"*.so "$staging/" || true
cp "target/${{ matrix.target }}/release/"*.dylib "$staging/" || true
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
# Upload to github
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_REPOSITORY: pluots/udf-suite
with:
body_path: RNOTES.md
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ env.ASSET }}