Skip to content

Commit dd877ac

Browse files
committed
Update Build Scripts
1 parent 828352c commit dd877ac

File tree

4 files changed

+132
-13
lines changed

4 files changed

+132
-13
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Build PK3
2+
description: Builds the PK3
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/checkout@v4
7+
- uses: montudor/action-zip@v1
8+
with:
9+
args: zip -r "AceCoreLib-${{ env.SUFFIX }}.pk3" . -i graphics/* sprites/* zscript/* CVARINFO LICENSE MAPINFO MENUDEF README.md ZSCRIPT.zs
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: 'Draft New Release'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'The version you want to release.'
8+
required: true
9+
10+
jobs:
11+
draft-new-release:
12+
name: 'Draft a New Release'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Create release branch
19+
run: git checkout -b release/${{ github.event.inputs.version }}
20+
21+
- name: Update Changelog
22+
uses: thomaseizinger/keep-a-changelog-new-release@1.1.0
23+
with:
24+
version: ${{ github.event.inputs.version }}
25+
26+
- name: Initialize mandatory git config
27+
run: |
28+
git config user.name "Github Actions"
29+
git config user.email "noreply@github.com"
30+
31+
- name: Commit Changelog
32+
id: make-commit
33+
run: |
34+
git add CHANGELOG.md
35+
git commit --message "Prepare release ${{ github.event.inputs.version }}"
36+
37+
echo "::set-output name=commit::$(git rev-parse HEAD)"
38+
39+
- name: Push New Branch
40+
run: git push origin release/${{ github.event.inputs.version }}
41+
42+
- name: Create Pull Request
43+
uses: thomaseizinger/create-pull-request@1.0.0
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
head: release/${{ github.event.inputs.version }}
48+
base: main
49+
title: Release ${{ github.event.inputs.version }}
50+
reviewers: ${{ github.actor }}
51+
body: |
52+
Hi @${{ github.actor }}!
53+
54+
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
55+
I've updated the changelog file in this commit: ${{ steps.make-commit.outputs.commit }}.
56+
57+
Merging this PR will create a GitHub release with the new PK3.

.github/workflows/nightly.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Nightly Build
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- id: build-suffix
14+
shell: bash
15+
run: echo "SUFFIX=${{ github.ref_name }}-$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT"
16+
- uses: ./.github/workflows/build-pk3
17+
env:
18+
SUFFIX: ${{ steps.build-suffix.outputs.SUFFIX }}
19+
- uses: actions/upload-artifact@v4
20+
with:
21+
name: Artifacts
22+
path: ./*.pk3

.github/workflows/release.yml

+44-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
1-
name: Release PK3s
1+
name: "Publish New Release"
22

33
on:
4-
push:
5-
tags:
6-
- "v*.*.*"
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
79

810
jobs:
9-
buildAndRelease:
11+
release:
12+
name: Publish New Release
1013
runs-on: ubuntu-latest
14+
if: github.event.pull_request.merged == true &&
15+
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
16+
1117
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v3
14-
- name: build PK3
15-
uses: montudor/action-zip@v1
16-
with:
17-
args: zip -r "AceCoreLib-${{ github.ref_name }}.pk3" . -i graphics/* sprites/* zscript/* CVARINFO LICENSE MAPINFO MENUDEF README.md ZSCRIPT.zs
18-
- name: Release PK3
19-
uses: softprops/action-gh-release@v0.1.7
18+
- name: Extract version from branch name (for release branches)
19+
if: startsWith(github.event.pull_request.head.ref, 'release/')
20+
run: |
21+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
22+
VERSION=${BRANCH_NAME#release/}
23+
24+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
25+
26+
- name: Extract version from branch name (for hotfix branches)
27+
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
28+
run: |
29+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
30+
VERSION=${BRANCH_NAME#hotfix/}
31+
32+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
33+
34+
# Build & Publish PK3
35+
- uses: actions/checkout@v4
36+
- id: build-suffix
37+
shell: bash
38+
run: echo "SUFFIX=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
39+
- uses: ./.github/workflows/build-pk3
40+
env:
41+
SUFFIX: ${{ steps.build-suffix.outputs.SUFFIX }}
42+
- uses: softprops/action-gh-release@v0.1.15
43+
env:
44+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2046
with:
47+
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
48+
tag_name: ${{ env.RELEASE_VERSION }}
49+
name: ${{ env.RELEASE_VERSION }}
50+
draft: false
51+
prerelease: false
2152
generate_release_notes: true
2253
discussion_category_name: 'Releases'
2354
files: ./*.pk3

0 commit comments

Comments
 (0)