-
-
Notifications
You must be signed in to change notification settings - Fork 12
114 lines (109 loc) · 3.52 KB
/
mean_bean_deploy.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
name: Mean Bean Deploy
env:
BIN: cartunes
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "[0-9]+\\.[0-9]+\\.[0-9]+" # Push events to matching semver tags
jobs:
windows:
name: Windows
runs-on: windows-latest
strategy:
matrix:
target:
# Windows
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Cargo build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release
# TODO: Compress with UPX
- run: |
cd ./target/release/
7z a "${{ env.BIN }}.zip" "${{ env.BIN }}.exe"
mv "${{ env.BIN }}.zip" $GITHUB_WORKSPACE
shell: bash
# We're using using a fork of `actions/create-release` that detects
# whether a release is already available or not first.
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
shell: bash
- uses: XAMPPRocky/[email protected]
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
# Draft should **always** be false. GitHub doesn't provide a way to
# get draft releases from its API, so there's no point using it.
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.BIN }}.zip
asset_name: ${{ env.BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.zip
asset_content_type: application/zip
macos:
name: macOS
runs-on: macos-latest
strategy:
matrix:
target:
# macOS
- x86_64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Cargo build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release
# TODO: macOS app package and disk image
- run: tar -czvf ${{ env.BIN }}.tar.gz --directory=target/release ${{ env.BIN }}
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: XAMPPRocky/[email protected]
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.BIN }}.tar.gz
asset_name: ${{ env.BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz
asset_content_type: application/gzip