Skip to content

Commit fc7c98c

Browse files
committed
add files
0 parents  commit fc7c98c

2 files changed

Lines changed: 1585 additions & 0 deletions

File tree

.github/workflows/releases.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: releases
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Tag for the new release. Use semantic versioning e.g. v1.0.0. Leave empty to only update the latest build.'
10+
type: string
11+
required: false
12+
default: ''
13+
14+
permissions:
15+
contents: write
16+
checks: write
17+
18+
jobs:
19+
tag:
20+
name: prepare tag
21+
if: ${{ github.actor != 'dependabot[bot]' }}
22+
runs-on: ubuntu-latest
23+
outputs:
24+
version: ${{ env.version }}
25+
buildTime: ${{ env.buildTime }}
26+
steps:
27+
- uses: actions/checkout@v5
28+
29+
- name: Set version
30+
shell: bash
31+
run: |
32+
if [ "${{ github.event.inputs.tag }}" != "" ]; then
33+
echo "version=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
34+
else
35+
echo "version=latest" >> $GITHUB_ENV
36+
fi
37+
echo "buildTime=$(date '+%Y.%m.%d')" >> $GITHUB_ENV
38+
39+
build:
40+
name: build & release
41+
if: ${{ github.actor != 'dependabot[bot]' }}
42+
needs: tag
43+
strategy:
44+
matrix:
45+
cfg:
46+
- runner_os: windows
47+
os: windows-2022
48+
- runner_os: linux
49+
os: ubuntu-22.04
50+
- runner_os: macos
51+
os: macos-14
52+
runs-on: ${{ matrix.cfg.os }}
53+
steps:
54+
- uses: actions/checkout@v5
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.12'
60+
61+
- name: Install build dependencies
62+
shell: bash
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install pyinstaller
66+
67+
- name: Build standalone binary with PyInstaller
68+
shell: bash
69+
run: |
70+
pyinstaller --onefile --name screenpack-updater screenpack-updater.py
71+
ls -R
72+
73+
- name: Prepare release artifact
74+
id: artifacts
75+
shell: bash
76+
run: |
77+
echo "Preparing files for deployment"
78+
mkdir -p deploy
79+
80+
if [ "$RUNNER_OS" = "Windows" ]; then
81+
cp dist/screenpack-updater.exe deploy/
82+
else
83+
cp dist/screenpack-updater deploy/
84+
fi
85+
86+
# Optional: include README if present
87+
if [ -f README.md ]; then
88+
cp README.md deploy/
89+
fi
90+
91+
cd deploy
92+
93+
if [ "${{ github.event.inputs.tag }}" = "" ]; then
94+
ARTIFACT_NAME=screenpack-updater-${{ matrix.cfg.runner_os }}.zip
95+
else
96+
ARTIFACT_NAME=screenpack-updater-${{ needs.tag.outputs.version }}-${{ matrix.cfg.runner_os }}.zip
97+
fi
98+
99+
echo "artifact=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
100+
101+
if [ "$RUNNER_OS" = "Windows" ]; then
102+
"/c/Program Files/7-Zip/7z.exe" a "../$ARTIFACT_NAME" *
103+
else
104+
zip -r "../$ARTIFACT_NAME" *
105+
fi
106+
107+
echo "Successfully prepared assets for deployment"
108+
109+
- name: Update latest release
110+
if: "${{ github.event.inputs.tag == '' }}"
111+
uses: ncipollo/release-action@v1
112+
with:
113+
#token: ${{ secrets.IKEMEN_TOKEN }}
114+
allowUpdates: true
115+
artifactErrorsFailBuild: true
116+
artifacts: "${{ steps.artifacts.outputs.artifact }}"
117+
body: |
118+
This release is built automatically from the latest commit. It may contain experimental or unstable changes.
119+
draft: false
120+
generateReleaseNotes: false
121+
makeLatest: false
122+
name: latest
123+
omitBody: false
124+
omitBodyDuringUpdate: false
125+
omitDraftDuringUpdate: true
126+
omitName: false
127+
omitNameDuringUpdate: true
128+
omitPrereleaseDuringUpdate: true
129+
prerelease: true
130+
removeArtifacts: false
131+
replacesArtifacts: true
132+
skipIfReleaseExists: false
133+
tag: latest
134+
updateOnlyUnreleased: false
135+
136+
- name: Create tagged Release
137+
if: "${{ github.event.inputs.tag != '' }}"
138+
uses: ncipollo/release-action@v1
139+
with:
140+
#token: ${{ secrets.IKEMEN_TOKEN }}
141+
allowUpdates: true
142+
artifactErrorsFailBuild: true
143+
artifacts: "${{ steps.artifacts.outputs.artifact }}"
144+
draft: false
145+
generateReleaseNotes: true
146+
makeLatest: true
147+
name: ${{ needs.tag.outputs.version }}
148+
omitBody: false
149+
omitBodyDuringUpdate: true
150+
omitDraftDuringUpdate: true
151+
omitName: false
152+
omitNameDuringUpdate: true
153+
omitPrereleaseDuringUpdate: true
154+
prerelease: false
155+
removeArtifacts: false
156+
replacesArtifacts: true
157+
skipIfReleaseExists: false
158+
tag: ${{ needs.tag.outputs.version }}
159+
updateOnlyUnreleased: false

0 commit comments

Comments
 (0)