-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (68 loc) · 2.25 KB
/
push.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
name: PSP Papers Tools
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
run: rustup toolchain install stable
- name: Install Cargo dependencies
run: cargo update
- name: Build
run: cargo build --release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: PapersTools
path: ./target/release/papers-tools.exe
create_release:
permissions:
contents: write
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && (contains(github.event.head_commit.message, '(release):') || contains(github.event.head_commit.message, '(pre-release):'))
steps:
- name: Get release version
run: |
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
RELEASE_NAME=$(echo "$COMMIT_MESSAGE" | sed -E 's/.*\((release|pre-release)\):\s*//')
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
- name: Determine if pre-release
run: |
echo "IS_PRE_RELEASE=$(echo "${{ github.event.head_commit.message }}" | grep -q "(pre-release):" && echo true || echo false)" >> $GITHUB_ENV
- name: Print RELEASE_NAME
run: |
echo "RELEASE_NAME=${{ env.RELEASE_NAME }}"
echo "IS_PRE_RELEASE=${{ env.IS_PRE_RELEASE }}"
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: PapersTools
- name: Rename Artifact
run: |
mv papers-tools.exe PapersTools-win-x64.exe
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_NAME }}
files: PapersTools-win-x64.exe
# body: Release desc
draft: false
prerelease: ${{ env.IS_PRE_RELEASE }}