-
-
Notifications
You must be signed in to change notification settings - Fork 14
127 lines (124 loc) · 4.98 KB
/
cd.yml
File metadata and controls
127 lines (124 loc) · 4.98 KB
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
120
121
122
123
124
125
126
127
name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
jobs:
publish-github:
name: Publish on GitHub
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux-gnu, win-gnu, win-msvc, win32-msvc, macos]
include:
- build: linux-gnu
os: ubuntu-20.04
toolchain: stable
target: x86_64-unknown-linux-gnu
- build: win-gnu
os: windows-2019
toolchain: stable
target: x86_64-pc-windows-gnu
- build: win-msvc
os: windows-2019
toolchain: stable
target: x86_64-pc-windows-msvc
- build: win32-msvc
os: windows-2019
toolchain: stable
target: i686-pc-windows-msvc
- build: macos
os: macos-10.15
toolchain: stable
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install packages (linux)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated libx11-dev libxrandr-dev
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
- name: Build the project (linux)
if: matrix.os == 'ubuntu-20.04'
run: |
if [ "${{ matrix.build }}" = "linux-arm" ]; then
PKG_CONFIG_ALLOW_CROSS=1 cargo build --verbose --release \
--locked --no-default-features --target ${{ matrix.target }}
else
PKG_CONFIG_ALLOW_CROSS=1 cargo build --verbose --release \
--locked --target ${{ matrix.target }}
fi
- name: Build the project (windows/macos)
if: matrix.os != 'ubuntu-20.04'
run: cargo build --verbose --release --locked --target ${{ matrix.target }}
- name: Prepare assets
shell: bash
run: |
mkdir -p assets/{completions,config}
cp {LICENSE,README.md,CHANGELOG.md} assets/
cp completions/{menyoki.bash,menyoki.fish,menyoki.zsh,menyoki.elvish,menyoki.powershell} \
assets/completions/
cp config/menyoki.conf assets/config/
if [ "${{ matrix.os }}" = "windows-2019" ]; then
cp target/${{ matrix.TARGET }}/release/menyoki.exe assets/
mv assets/ menyoki-${{ env.RELEASE_VERSION }}/
7z a -tzip "menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip" \
menyoki-${{ env.RELEASE_VERSION }}
else
mkdir assets/man
cp man/{menyoki.1,menyoki.conf.5} assets/man/
cp target/${{ matrix.TARGET }}/release/menyoki assets/
mv assets/ menyoki-${{ env.RELEASE_VERSION }}/
tar -czvf menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz \
menyoki-${{ env.RELEASE_VERSION }}
shasum -a 512 menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz \
> menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz.sha512
echo "${{ secrets.GPG_RELEASE_KEY }}" | base64 --decode > release.key
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback \
--passphrase-fd 0 --import release.key
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback \
--passphrase-fd 0 --detach-sign \
menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz
fi
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
body: |
<a href="https://github.com/orhun/menyoki"><img src="https://user-images.githubusercontent.com/24392180/98470768-09356680-21f9-11eb-81de-94a622b32db4.png" width="300"></a>
See [**changelog**](https://github.com/orhun/menyoki/blob/master/CHANGELOG.md) for release notes.
publish-crates-io:
name: Publish on crates.io
needs: publish-github
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated libx11-dev libxrandr-dev
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
override: true
- name: Publish
run: cargo publish --locked --token ${{ secrets.CARGO_TOKEN }}