-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (84 loc) · 3.23 KB
/
build.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
name: build
on:
push:
tags: ["v*.*.*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run tests
run: cargo test --verbose
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
rustup target add x86_64-pc-windows-gnu
rustup target add i686-pc-windows-gnu
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-apple-darwin
mkdir dist
mkdir builds
- name: Build Win64
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
cargo rustc --bin envful --release --target=x86_64-pc-windows-gnu -- -C linker=x86_64-w64-mingw32-gcc
mkdir builds/envful-${VERSION}-win64
cp target/x86_64-pc-windows-gnu/release/envful.exe builds/envful-${VERSION}-win64
tar -C builds -czvf dist/envful-${VERSION}-win64.tar.gz envful-${VERSION}-win64
- name: Cache Mac OS dependencies
id: cache-macos
uses: actions/cache@v2
with:
path: osxcross
key: osxcross
- name: Install Mac OS dependencies
if: steps.cache-macos.outputs.cache-hit != 'true'
run: |
git clone https://github.com/tpoechtrager/osxcross
cd osxcross
sudo tools/get_dependencies.sh
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
mv MacOSX10.10.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
- name: Build Mac OS
env:
CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER: "x86_64-apple-darwin14-clang"
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
export PATH="$(pwd)/osxcross/target/bin:$PATH"
export LIBZ_SYS_STATIC=1
export CC=o64-clang
export CXX=o64-clang++
cargo build --release --target "x86_64-apple-darwin"
mkdir builds/envful-${VERSION}-macos
cp target/x86_64-apple-darwin/release/envful builds/envful-${VERSION}-macos
tar -C builds -czvf dist/envful-${VERSION}-macos.tar.gz envful-${VERSION}-macos
- name: Build Linux
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
cargo rustc --bin envful --release --target=x86_64-unknown-linux-gnu
mkdir builds/envful-${VERSION}-linux
cp target/x86_64-unknown-linux-gnu/release/envful builds/envful-${VERSION}-linux
tar -C builds -czvf dist/envful-${VERSION}-linux.tar.gz envful-${VERSION}-linux
- name: Upload release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
dist/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish npm package
env:
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" > ".npmrc"
npm publish
- name: Publish cargo package
env:
CARGO_ACCESS_TOKEN: ${{ secrets.CARGO_ACCESS_TOKEN }}
run: |
cargo login "$CARGO_ACCESS_TOKEN"
cargo publish --allow-dirty