-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (125 loc) · 4.46 KB
/
universal.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
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
on:
push:
tags:
- 'v*'
- 'b*'
jobs:
release:
strategy:
matrix:
target_os: [macos-latest, ubuntu-20.04, windows-latest]
name: Universal Publish Binaries
runs-on: ${{matrix.target_os}}
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.inputs.branch}}
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{matrix.target_os}}
- name: Install Cargo Get
uses: actions-rs/install@v0.1
with:
crate: cargo-get
version: latest
- name: Get the version
id: get_version
run: echo "::set-output name=VERSION::$(cargo get package.version --entry corr)"
## Windows Steps For Building and Publishing Binaries
- name: Install Wix
if: "contains(matrix.target_os, 'windows')"
uses: actions-rs/install@v0.1
with:
crate: cargo-wix
version: latest
- name: Build Binary
if: "contains(matrix.target_os, 'windows')"
uses: actions-rs/cargo@v1
with:
command: wix
args: --package corr
- name: Upload corr binaries to release
if: "contains(matrix.target_os, 'windows')"
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ format('target/wix/corr-{0}-x86_64.msi', steps.get_version.outputs.VERSION) }}
asset_name: ${{ format('corr-{0}-x86_64.msi', steps.get_version.outputs.VERSION) }}
tag: ${{ github.ref }}
overwrite: true
## Ubuntu Steps For Building and Publishing Binaries
- name: Build corr Package
uses: actions-rs/cargo@v1
if: "contains(matrix.target_os, 'ubuntu')"
with:
command: build
args: --release --all-features --package corr
- name: Script To create Debian Package
if: "contains(matrix.target_os, 'ubuntu')"
run: |
mkdir -p .debpkg/usr/bin
mkdir -p .debpkg/usr/lib/corr
cp target/release/corr .debpkg/usr/bin/corr
chmod +x .debpkg/usr/bin/corr
echo -e "a=1" > .debpkg/usr/lib/corr/corr.conf
- name: Build Debian Bundle
if: "contains(matrix.target_os, 'ubuntu')"
uses: jiro4989/build-deb-action@v2
id: bundle_debian
with:
package: corr
package_root: .debpkg
maintainer: Atmaram
version: ${{steps.get_version.outputs.VERSION}}
arch: 'amd64'
desc: 'Corr Binaries'
- name: Upload corr binaries to release
if: "contains(matrix.target_os, 'ubuntu')"
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{steps.bundle_debian.outputs.file_name}}
asset_name: ${{steps.bundle_debian.outputs.file_name}}
tag: ${{ github.ref }}
overwrite: true
## macos Steps For Building and Publishing Binaries
- name: Build corr Package
if: "contains(matrix.target_os, 'macos')"
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --package corr
- name: Compress corr package
if: "contains(matrix.target_os, 'macos')"
uses: a7ul/tar-action@v1.1.0
id: compress-corr
with:
command: c
cwd: target/release
files: |
corr
outPath: corr.tar.gz
- name: Upload corr binaries to release
if: "contains(matrix.target_os, 'macos')"
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: corr.tar.gz
asset_name: corr.tar.gz
tag: ${{ github.ref }}
overwrite: true
- name: Update corr formula
if: "contains(matrix.target_os, 'macos') && !contains(github.ref, '-')"
uses: mislav/bump-homebrew-formula-action@v1.6
env:
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
with:
homebrew-tap: atmnk/homebrew-corr
formula-name: corr
download-url: ${{format('{0}{1}{2}', 'https://github.com/atmnk/corr/releases/download/v', steps.get_version.outputs.VERSION , '/corr.tar.gz')}}
commit-message: 'Bump up {{formulaName}} formula to v{{version}} version'