Skip to content

Commit 4e8498d

Browse files
authored
Combine test and release workflows & Add Winget Releaser (#53)
* Combine test and release workflows * Add Winget Releaser workflow * Limit to 5 keywords on Cargo.toml * Add winget installation in the readme
1 parent 66e8830 commit 4e8498d

File tree

4 files changed

+54
-42
lines changed

4 files changed

+54
-42
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
1-
name: Rust CI
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
tags:
6+
- 'v*'
7+
branches:
8+
- main
69
pull_request:
7-
branches: [ main ]
10+
branches:
11+
- main
812

913
env:
1014
CARGO_TERM_COLOR: always
11-
RUST_BACKTRACE: 1
1215

1316
jobs:
1417
build:
18+
runs-on: windows-latest
19+
env:
20+
RUST_BACKTRACE: 1
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: Swatinem/rust-cache@v2
25+
- name: Build
26+
run: cargo build --release
27+
- name: Run tests
28+
run: cargo test --verbose
29+
- name: Upload artifact
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: PowerSession
33+
path: target/release/PowerSession.exe
1534

35+
publish:
36+
needs: build
1637
runs-on: windows-latest
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
env:
40+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
1741

1842
steps:
19-
- uses: actions/checkout@v3
20-
- uses: Swatinem/rust-cache@v1
21-
- name: Run tests
22-
run: cargo test --verbose
43+
- uses: actions/checkout@v3
44+
- uses: Swatinem/rust-cache@v2
45+
- name: Publish to crates.io
46+
run: cargo publish --verbose
47+
- name: Get PowerSession artifact
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: PowerSession
51+
path: target/release
52+
- name: Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
files: .\target\release\PowerSession.exe
56+
- name: Publish to WinGet
57+
uses: vedantmgoyal2009/winget-releaser@latest
58+
with:
59+
identifier: Watfaq.PowerSession
60+
release-tag: ${{ github.ref }}
61+
token: ${{ secrets.WINGET_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Asciinema-compatible terminal session recorder for Windows"
99
readme = "README.md"
1010
homepage = "https://github.com/Watfaq/PowerSession-rs"
1111
repository = "https://github.com/Watfaq/PowerSession-rs"
12-
keywords = ["cli", "powershell", "asciinema", "terminal", "recorder", "conpty", "powersession"]
12+
keywords = ["cli", "asciinema", "terminal", "recorder", "conpty"]
1313
categories = ["command-line-utilities"]
1414

1515
[dependencies]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ A port of [asciinema](https://github.com/asciinema/asciinema) for Windows, based
2525
cargo install PowerSession
2626
```
2727

28+
### Winget
29+
30+
```console
31+
winget install Watfaq.PowerSession
32+
```
33+
2834
### Scoop
2935

3036
```console

0 commit comments

Comments
 (0)