Skip to content

Commit e962cbf

Browse files
committed
ci: build and release in auto-version
1 parent a3c0045 commit e962cbf

2 files changed

Lines changed: 148 additions & 17 deletions

File tree

.github/workflows/auto_version.yml

Lines changed: 144 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
(github.event_name == 'workflow_dispatch' ||
3232
!contains(github.event.head_commit.message, 'chore(release):'))
3333
runs-on: ubuntu-latest
34+
outputs:
35+
tagged: ${{ steps.tag.outputs.tagged }}
36+
version: ${{ steps.version.outputs.version }}
3437
steps:
3538
- name: Checkout
3639
uses: actions/checkout@v4
@@ -62,6 +65,7 @@ jobs:
6265
id: tag
6366
shell: bash
6467
run: |
68+
echo "tagged=false" >> "$GITHUB_OUTPUT"
6569
git config user.name "github-actions[bot]"
6670
git config user.email "github-actions[bot]@users.noreply.github.com"
6771
git add VERSION CHANGELOG.md
@@ -75,18 +79,144 @@ jobs:
7579
git push --tags
7680
echo "tagged=true" >> "$GITHUB_OUTPUT"
7781
78-
- name: Dispatch Release Workflow
79-
if: steps.tag.outputs.tagged == 'true'
80-
uses: actions/github-script@v7
82+
build:
83+
needs: tag
84+
if: needs.tag.outputs.tagged == 'true'
85+
name: build-${{ matrix.os }}
86+
runs-on: ${{ matrix.os }}
87+
strategy:
88+
fail-fast: false
89+
matrix:
90+
os: [windows-latest, macos-latest, ubuntu-latest]
91+
92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
with:
96+
fetch-depth: 0
97+
98+
- name: Checkout Release Tag
99+
shell: bash
100+
run: |
101+
git fetch --tags --force
102+
git checkout "v${{ needs.tag.outputs.version }}"
103+
104+
- name: Setup Python
105+
uses: actions/setup-python@v5
106+
with:
107+
python-version: "3.x"
108+
109+
- name: Install Meson + Ninja
110+
run: python -m pip install --upgrade pip meson ninja
111+
112+
- name: Install Qt
113+
uses: jurplel/install-qt-action@v4
114+
with:
115+
version: "6.10.1"
116+
arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2022_64' || matrix.os == 'macos-latest' && 'clang_64' || 'gcc_64' }}
117+
118+
- name: Determine Update Channel
119+
shell: bash
120+
run: |
121+
version="$(cat VERSION)"
122+
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
123+
echo "PAKFU_UPDATE_CHANNEL=dev" >> "$GITHUB_ENV"
124+
else
125+
echo "PAKFU_UPDATE_CHANNEL=stable" >> "$GITHUB_ENV"
126+
fi
127+
128+
- name: Configure
129+
run: meson setup build --backend ninja -Dgithub_repo=${{ github.repository }} -Dupdate_channel=$PAKFU_UPDATE_CHANNEL
130+
131+
- name: Build
132+
run: meson compile -C build
133+
134+
- name: Package (Windows)
135+
if: matrix.os == 'windows-latest'
136+
shell: pwsh
137+
run: ./scripts/package_windows.ps1
138+
139+
- name: Package (macOS)
140+
if: matrix.os == 'macos-latest'
141+
shell: bash
142+
run: bash scripts/package_macos.sh
143+
144+
- name: Package (Linux)
145+
if: matrix.os == 'ubuntu-latest'
146+
shell: bash
147+
run: bash scripts/package_linux.sh
148+
149+
- name: Upload Artifacts
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: pakfu-${{ matrix.os }}
153+
path: |
154+
dist/*.zip
155+
dist/*.tar.gz
156+
dist/*.tgz
157+
dist/*.tar.xz
158+
dist/*.AppImage
159+
dist/*.dmg
160+
dist/*.pkg
161+
dist/*.exe
162+
dist/*.msi
163+
164+
release:
165+
needs: [tag, build]
166+
if: needs.tag.outputs.tagged == 'true'
167+
name: github-release
168+
runs-on: ubuntu-latest
169+
steps:
170+
- name: Checkout
171+
uses: actions/checkout@v4
172+
with:
173+
fetch-depth: 0
174+
175+
- name: Checkout Release Tag
176+
shell: bash
177+
run: |
178+
git fetch --tags --force
179+
git checkout "v${{ needs.tag.outputs.version }}"
180+
181+
- name: Setup Python
182+
uses: actions/setup-python@v5
183+
with:
184+
python-version: "3.x"
185+
186+
- name: Download Artifacts
187+
uses: actions/download-artifact@v4
188+
with:
189+
path: dist
190+
merge-multiple: true
191+
192+
- name: Resolve Version
193+
shell: bash
194+
run: |
195+
version="$(cat VERSION)"
196+
echo "PAKFU_VERSION=$version" >> "$GITHUB_ENV"
197+
198+
- name: Determine Release Type
199+
shell: bash
200+
run: |
201+
version="${PAKFU_VERSION}"
202+
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
203+
echo "PAKFU_PRERELEASE=true" >> "$GITHUB_ENV"
204+
else
205+
echo "PAKFU_PRERELEASE=false" >> "$GITHUB_ENV"
206+
fi
207+
208+
- name: Prepare Release Notes
209+
shell: bash
210+
run: |
211+
python scripts/release_notes.py --version "v${PAKFU_VERSION}" --output release_notes.md
212+
213+
- name: Publish Release
214+
uses: softprops/action-gh-release@v2
81215
with:
82-
script: |
83-
const version = "${{ steps.version.outputs.version }}";
84-
await github.rest.actions.createWorkflowDispatch({
85-
owner: context.repo.owner,
86-
repo: context.repo.repo,
87-
workflow_id: "release.yml",
88-
ref: "main",
89-
inputs: {
90-
ref: `v${version}`
91-
}
92-
});
216+
tag_name: v${{ env.PAKFU_VERSION }}
217+
name: v${{ env.PAKFU_VERSION }}
218+
files: dist/**
219+
body_path: release_notes.md
220+
generate_release_notes: false
221+
fail_on_unmatched_files: true
222+
prerelease: ${{ env.PAKFU_PRERELEASE == 'true' }}

docs/RELEASES.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ the updater can select the correct file automatically.
5757
1. Push to `main` (default: auto-creates a **dev** prerelease).
5858
2. The `auto-version` workflow computes the next version, updates `VERSION`,
5959
updates `CHANGELOG.md`, commits, and tags it.
60-
3. The `auto-version` workflow dispatches the `release` workflow, which builds
61-
and publishes packages for the tag, using the matching changelog entry as
62-
release notes.
60+
3. The same `auto-version` workflow then builds packages and publishes the
61+
GitHub Release for that tag, using the matching changelog entry as release
62+
notes.
6363
4. For a stable release, run the `auto-version` workflow manually with
6464
`channel=stable`.
65+
5. `release.yml` remains available for manual re-runs if needed.
6566

6667
The release workflow uses the repository name as the update source and publishes
6768
the artifacts to the GitHub Release matching the tag.

0 commit comments

Comments
 (0)