-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (100 loc) · 3.35 KB
/
release.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
name: Build and Release Python Executable
on:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
# uses: actions/checkout@v2
run: |
git clone https://github.com/RetroCyber/thcrap_patch_mirror.git
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Check for Python changes
id: check_python
shell: bash
run: |
cd thcrap_patch_mirror
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '\.py$' ; then
echo "Python files were changed."
echo "python_changed=true" >> $GITHUB_OUTPUT
else
echo "No Python files were changed."
echo "python_changed=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
if: steps.check_python.outputs.python_changed == 'true'
run: |
cd thcrap_patch_mirror
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executables
if: steps.check_python.outputs.python_changed == 'true'
run: |
cd thcrap_patch_mirror
pyinstaller --onefile add_patch.py
pyinstaller --onefile mirror_repo.py
- name: Package executables on Windows
if: runner.os == 'Windows'
run: |
Compress-Archive -Path 'dist/add_patch.exe', 'dist/mirror_repo.exe' -DestinationPath thpatch_mirror.zip
shell: pwsh
working-directory: thcrap_patch_mirror
- name: Package executables on Linux
if: runner.os == 'Linux'
run: |
tar -czf thpatch_mirror.tar.gz dist/add_patch dist/mirror_repo
shell: bash
working-directory: thcrap_patch_mirror
- name: Package executables on Linux and macOS
if: runner.os == 'macOS'
run: |
tar -czf thpatch_mirror.tar.gz dist/add_patch dist/mirror_repo
shell: bash
working-directory: thcrap_patch_mirror
- name: Upload Package
if: steps.check_python.outputs.python_changed == 'true'
uses: actions/upload-artifact@v4
with:
name: thpatch_mirror-${{ matrix.os }}
path: |
thcrap_patch_mirror/dist/thpatch_mirror.tar.gz
thcrap_patch_mirror/dist/thpatch_mirror.zip
# release:
# runs-on: ubuntu-latest
# needs: build
# if: needs.build.outputs.python_changed == 'true'
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.sha }}
# release_name: Release ${{ github.sha }}
# body: ${{ github.event.head_commit.message }}
# draft: false
# prerelease: false
# - name: Upload Release Assets
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: |
# thpatch_mirror.zip
# thpatch_mirror.tar.gz
# asset_name: ${{ matrix.os }}_thpatch_mirror
# asset_content_type: application/zip