-
Notifications
You must be signed in to change notification settings - Fork 28
102 lines (87 loc) · 2.5 KB
/
release.yml
File metadata and controls
102 lines (87 loc) · 2.5 KB
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
# -*- coding: utf-8 -*-
name: Build and Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for testing (e.g. v2.0.1)'
required: false
type: string
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
architecture: [x64]
python-version: ['3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
pytest -v --cov=remark --cov-report=term-missing
- name: Install PyInstaller
run: |
pip install pyinstaller
- name: Build executable
run: |
pyinstaller remark.spec --clean
- name: Rename executable with version
run: |
if ($env:GITHUB_REF -match "refs/tags/v(.*)") {
$version = $matches[1]
} else {
$version = "dev"
}
Copy-Item "dist\windows-folder-remark.exe" "dist\windows-folder-remark-$version.exe"
- name: Generate checksum
run: |
if ($env:GITHUB_REF -match "refs/tags/v(.*)") {
$version = $matches[1]
} else {
$version = "dev"
}
$file = "dist\windows-folder-remark-$version.exe"
certutil -hashfile $file SHA256 > "$file.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-folder-remark-${{ matrix.architecture }}
path: |
dist/*.exe
dist/*.sha256
release:
needs: build
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag_name || github.ref_name }}
draft: ${{ github.event_name == 'workflow_dispatch' }}
prerelease: false
generate_release_notes: true
files: |
artifacts/**/*.exe
artifacts/**/*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}