-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (116 loc) · 4.15 KB
/
releases.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Prepare release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Retrieve cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: cargo build --release
uses: actions-rs/cargo@v1
with:
command: build
args: --release
env:
TARGET: x86_64-unknown-linux-musl
- name: Create checksum
run: |
sha256sum target/release/i3nator > target/release/i3nator.sha256
- name: Identify if tag is a prerelease
id: tag
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/(.+)$ ]]; then
echo "::set-output name=value::${BASH_REMATCH[1]}"
else
echo "::error ::Expected a tag"
exit 1
fi
if [[ "${{ github.ref }}" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::set-output name=is-prerelease::false"
else
echo "::set-output name=is-prerelease::true"
fi
- name: Extract current changelog
id: changelog
run:
|
changelog="$(hack/extract-current-changelog.py CHANGELOG.md)"
# https://github.community/t/set-output-truncates-multiline-strings/16852/3
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=value::$changelog"
- name: Prepare release
id: prepare-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: v${{ github.ref }}
draft: true
prerelease: ${{ steps.tag.outputs.is-prerelease }}
body: |
# Summary
TODO!
## Changes
${{ steps.changelog.outputs.value }}
## Installation
You have multiple options to install i3nator:
1. Download the static binary from this release. This will work without any additional dependencies.
2. If you have at least Rust 1.56.1 with Cargo installed, you can install i3nator directly from crates.io:
```console
$ cargo install i3nator
```
If you are updating i3nator through cargo, just use:
```console
$ cargo install --force i3nator
```
In case you want to install this specific version, you can specify the `--version` argument:
```console
$ cargo install --force --version ${{ steps.tag.outputs.value }} i3nator
```
3. Another option is to install from directly from source (this requires at least Rust 1.56.1):
```console
$ git clone https://github.com/pitkley/i3nator.git
$ cd i3nator
$ cargo install
```
**Note:** If you want to be able to use the automatic command execution feature, you will need to install [`xdotool`][xdotool].
[xdotool]: https://github.com/jordansissel/xdotool
- name: Upload static i3nator binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.prepare-release.outputs.upload_url }}
asset_path: target/release/i3nator
asset_name: i3nator
asset_content_type: application/octet-stream
- name: Upload static i3nator binary checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.prepare-release.outputs.upload_url }}
asset_path: target/release/i3nator.sha256
asset_name: i3nator.sha256
asset_content_type: application/octet-stream