-
-
Notifications
You must be signed in to change notification settings - Fork 13
126 lines (104 loc) · 4.51 KB
/
build_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
116
117
118
119
120
121
122
123
124
125
126
name: Build and Release Project
on:
push:
branches:
- main
env:
VERSION: 1.20.4
jobs:
build_and_release_windows:
runs-on: windows-2022
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.START_BUILD == 'True'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Fetch Pillow files
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/Imaging.h" -OutFile "Imaging.h"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImagingUtils.h" -OutFile "ImagingUtils.h"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImPlatform.h" -OutFile "ImPlatform.h"
- name: Build project for Windows
run: |
python setup.py build
pyinstaller overviewer.spec
- name: Create ZIP file for Windows
run: |
Compress-Archive -Path .\dist\overviewer -DestinationPath overviewer-${{ env.VERSION }}-windows.zip
- name: Create Release for Windows
id: create_release_windows
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: |
Created using [The Minecraft Overviewer v1.20.4](https://github.com/GregoryAM-SP/The-Minecraft-Overviewer/releases/tag/v1.20.4)
draft: false
prerelease: false
- name: Upload Windows Release Asset
id: upload_windows_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_windows.outputs.upload_url }}
asset_path: ./overviewer-${{ env.VERSION }}-windows.zip
asset_name: overviewer-${{ env.VERSION }}-windows.zip
asset_content_type: application/zip
outputs:
upload_url: ${{ steps.create_release_windows.outputs.upload_url }}
build_and_release_linux:
runs-on: ubuntu-22.04
needs: build_and_release_windows
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.START_BUILD == 'True'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: pip install -r requirements.txt
- name: Fetch Pillow files
run: |
curl -o Imaging.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/Imaging.h
curl -o ImagingUtils.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImagingUtils.h
curl -o ImPlatform.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImPlatform.h
- name: Build project for Linux
run: |
python setup.py build
pyinstaller overviewer.spec
- name: Create tar.xz archive for Linux
run: |
cd dist
tar -cf overviewer-${{ env.VERSION }}-LINUX.tar overviewer
xz -z overviewer-${{ env.VERSION }}-LINUX.tar
mv overviewer-${{ env.VERSION }}-LINUX.tar.xz ../overviewer-${{ env.VERSION }}-LINUX.tar.xz
- name: Get upload URL
run: 'echo "Upload URL: ${{ needs.build_and_release_windows.outputs.upload_url }}"'
- name: Upload Linux Release Asset
id: upload_linux_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build_and_release_windows.outputs.upload_url }}
asset_path: ./overviewer-${{ env.VERSION }}-LINUX.tar.xz
asset_name: overviewer-${{ env.VERSION }}-LINUX.tar.xz
asset_content_type: application/x-xz