Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.

Commit bad6747

Browse files
committed
ci: development workflow for publish dev versions
1 parent dae0ac9 commit bad6747

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Development Release
2+
3+
on:
4+
push:
5+
branches: [development]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
outputs:
13+
version: ${{ steps.version.outputs.version }}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Generate development version
25+
id: version
26+
run: |
27+
BASE_VERSION=$(cat VERSION | tr -d '\n')
28+
DATE=$(date +'%Y%m%d')
29+
SHORT_SHA=${GITHUB_SHA::7}
30+
DEV_VERSION="${BASE_VERSION}-dev.${DATE}.${SHORT_SHA}"
31+
32+
echo "version=${DEV_VERSION}" >> $GITHUB_OUTPUT
33+
echo "base_version=${BASE_VERSION}" >> $GITHUB_OUTPUT
34+
echo "Generated version: ${DEV_VERSION}"
35+
36+
- name: Build for Linux and Windows
37+
run: |
38+
mkdir -p artifacts
39+
40+
# Run build using docker compose
41+
docker compose run --rm build
42+
43+
# Copy generated artifacts
44+
if [ -f "dist/sbagen+-linux64" ]; then
45+
cp dist/sbagen+-linux64 artifacts/sbagen+-linux64
46+
fi
47+
48+
if [ -f "dist/sbagen+-linux32" ]; then
49+
cp dist/sbagen+-linux32 artifacts/sbagen+-linux32
50+
fi
51+
52+
if [ -f "dist/sbagen+-windows-setup.exe" ]; then
53+
cp dist/sbagen+-windows-setup.exe artifacts/sbagen+-windows-setup.exe
54+
fi
55+
56+
- name: Generate SHA256 checksums
57+
run: |
58+
cd artifacts
59+
find . -type f -exec sha256sum {} \; | sort > ../checksums.txt
60+
cat ../checksums.txt
61+
62+
- name: Upload artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: sbagen-plus-${{ steps.version.outputs.version }}
66+
path: |
67+
artifacts/
68+
checksums.txt
69+
retention-days: 30
70+
71+
create-release:
72+
needs: build
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Download artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: sbagen-plus-${{ needs.build.outputs.version }}
83+
84+
- name: Generate release body with checksums
85+
run: |
86+
echo "**This is a development version and may contain bugs or unstable features.**" > release_body.md
87+
echo "" >> release_body.md
88+
echo "SHA256SUM:" >> release_body.md
89+
90+
if [ -f checksums.txt ]; then
91+
while IFS= read -r line; do
92+
# Extract hash and filename
93+
hash=$(echo "$line" | cut -d' ' -f1)
94+
file=$(echo "$line" | cut -d' ' -f3- | sed 's|^\./||')
95+
echo "$hash $file" >> release_body.md
96+
done < checksums.txt
97+
fi
98+
99+
cat release_body.md
100+
101+
- name: Create Development Release
102+
uses: softprops/action-gh-release@v1
103+
with:
104+
tag_name: v${{ needs.build.outputs.version }}
105+
name: "Development Release v${{ needs.build.outputs.version }}"
106+
body_path: release_body.md
107+
files: |
108+
artifacts/*
109+
prerelease: true
110+
draft: false
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)