-
Notifications
You must be signed in to change notification settings - Fork 79
[GITHUB] Add weekly pre-releases workflow for Generals and GeneralsMD #929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.9.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this versioning should be left out of the weekly builds completely personally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. We can make the versioning enterily independent of the CI. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,298 @@ | ||
name: Weekly Release | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
force_changed: | ||
description: 'Force build' | ||
required: false | ||
default: 'false' | ||
type: choice | ||
options: | ||
- 'false' | ||
- 'true' | ||
pre-release: | ||
description: 'Mark release as pre-release' | ||
required: false | ||
default: 'false' | ||
type: choice | ||
options: | ||
- 'false' | ||
- 'true' | ||
|
||
schedule: | ||
- cron: '0 8 * * 1' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
detect-scm-changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changed: ${{ steps.check.outputs.changed }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
- id: check | ||
run: | | ||
if [ "${{ github.event.inputs.force_changed }}" = "true" ]; then | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
|
||
echo LAST TAG: | ||
git describe --tags --abbrev=0 2>/dev/null || echo "" | ||
|
||
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
if [ -z "$LAST_TAG" ]; then | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
CHANGED=$(git diff --name-only $LAST_TAG..HEAD | grep -v '.github/workflows/' | wc -l) | ||
if [ "$CHANGED" -eq "0" ]; then | ||
echo "changed=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
calculate-version: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What benefit do we get creating these files to be moved around rather than just calculating the information and storing it in variables where the workflow requires it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed by build-toolchain and will be used in C++ counterpart here and here |
||
name: Generate version files | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Create Version Files | ||
run: | | ||
BASE_TAG=$(cat .github/workflows/base-version.txt) | ||
IFS='.' read -r major minor patch <<<"$BASE_TAG" | ||
CURRENT_TAG=$(git tag --list "$major.$minor*" --sort=-v:refname | head -n1) | ||
CURRENT_COMMIT=$(git rev-parse HEAD) | ||
|
||
if [ -z "$CURRENT_TAG" ]; then | ||
CURRENT_TAG="$BASE_TAG" | ||
NEXT_TAG="$BASE_TAG" | ||
else | ||
IFS='.' read -r major minor patch <<<"$CURRENT_TAG" | ||
NEXT_TAG="$major.$minor.$((patch+1))" | ||
fi | ||
|
||
echo "CURRENT_TAG: $CURRENT_TAG" | ||
echo "NEXT_TAG: $NEXT_TAG" | ||
|
||
echo "$CURRENT_TAG" > current_tag.txt | ||
echo "$NEXT_TAG" > next_tag.txt | ||
echo "$CURRENT_COMMIT" > git_commit.txt | ||
|
||
- name: Upload version files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: version_files | ||
path: | | ||
next_tag.txt | ||
current_tag.txt | ||
git_commit.txt | ||
|
||
build-generals: | ||
needs: [detect-scm-changes, calculate-version] | ||
if: needs.detect-scm-changes.outputs.changed == 'true' | ||
name: Build Generals${{ matrix.preset && '' }} | ||
strategy: | ||
matrix: | ||
include: | ||
- preset: "vc6" | ||
tools: true | ||
extras: true | ||
release: true | ||
- preset: "win32-vcpkg" | ||
tools: true | ||
extras: true | ||
release: true | ||
fail-fast: false | ||
uses: ./.github/workflows/build-toolchain.yml | ||
with: | ||
game: "Generals" | ||
preset: ${{ matrix.preset }} | ||
tools: ${{ matrix.tools }} | ||
extras: ${{ matrix.extras }} | ||
release: ${{ matrix.release }} | ||
secrets: inherit | ||
|
||
build-generalsmd: | ||
needs: [detect-scm-changes, calculate-version] | ||
if: needs.detect-scm-changes.outputs.changed == 'true' | ||
name: Build GeneralsMD${{ matrix.preset && '' }} | ||
strategy: | ||
matrix: | ||
include: | ||
- preset: "vc6" | ||
tools: true | ||
extras: true | ||
release: true | ||
- preset: "win32" | ||
tools: true | ||
extras: true | ||
release: true | ||
fail-fast: false | ||
uses: ./.github/workflows/build-toolchain.yml | ||
with: | ||
game: "GeneralsMD" | ||
preset: ${{ matrix.preset }} | ||
tools: ${{ matrix.tools }} | ||
extras: ${{ matrix.extras }} | ||
release: ${{ matrix.release }} | ||
secrets: inherit | ||
|
||
create-release: | ||
name: Create Release | ||
needs: [ build-generals, build-generalsmd ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Download version file | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: version_files | ||
|
||
- name: Read base version | ||
id: base_version | ||
run: echo "base_version=$(cat .github/workflows/base-version.txt)" >> $GITHUB_OUTPUT | ||
|
||
- name: Get latest semver tag | ||
id: get_tag | ||
run: echo "current_tag=$(cat current_tag.txt)" >> $GITHUB_OUTPUT | ||
|
||
- name: Calculate next version | ||
id: next_version | ||
run: echo "next_tag=$(cat next_tag.txt)" >> $GITHUB_OUTPUT | ||
|
||
- name: Collect commits since last release | ||
id: changelog | ||
run: | | ||
TAG=${{ steps.get_tag.outputs.current_tag }} | ||
NEXT=${{ steps.next_version.outputs.next_tag }} | ||
if [ "$TAG" == "$NEXT" ]; then | ||
{ | ||
echo "commits<<EOF" | ||
git log --pretty=format:"- %s" | head -n10 | grep -v "Sync Generals repos" | ||
echo "EOF" | ||
} >> $GITHUB_OUTPUT | ||
else | ||
{ | ||
echo "commits<<EOF" | ||
git log "$TAG"..HEAD --pretty=format:"- %s" | grep -v "Sync Generals repos" | ||
echo "EOF" | ||
} >> $GITHUB_OUTPUT | ||
fi | ||
|
||
# Generals vc6 | ||
- name: Download Generals VC6 Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Generals-vc6+t+e | ||
path: generals-vc6-artifacts | ||
|
||
- name: Prepare and Zip Generals VC6 | ||
run: | | ||
mkdir generals-vc6-release | ||
cp generals-vc6-artifacts/generalsv.exe generals-vc6-release/GeneralsV.exe | ||
cp generals-vc6-artifacts/W3DViewV.exe generals-vc6-release/W3DViewV.exe | ||
cp generals-vc6-artifacts/WorldBuilderV.exe generals-vc6-release/WorldBuilderV.exe | ||
zip -j generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip generals-vc6-release/* | ||
|
||
# Generals win32 | ||
- name: Download Generals Win32 Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: Generals-win32-vcpkg+t+e | ||
path: generals-win32-artifacts | ||
|
||
- name: Prepare and Zip Generals Win32 | ||
run: | | ||
mkdir generals-win32-release | ||
cp generals-win32-artifacts/generalsv.exe generals-win32-release/GeneralsV.exe | ||
cp generals-win32-artifacts/W3DViewV.exe generals-win32-release/W3DViewV.exe | ||
cp generals-win32-artifacts/WorldBuilderV.exe generals-win32-release/WorldBuilderV.exe | ||
zip -j generals-win32-${{ steps.next_version.outputs.next_tag }}.zip generals-win32-release/* | ||
|
||
# GeneralsMD vc6 | ||
- name: Download GeneralsMD VC6 Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: GeneralsMD-vc6+t+e | ||
path: generalsmd-vc6-artifacts | ||
|
||
- name: Prepare and Zip GeneralsMD VC6 | ||
run: | | ||
mkdir generalsmd-vc6-release | ||
cp generalsmd-vc6-artifacts/generalszh.exe generalsmd-vc6-release/GeneralsZHv.exe | ||
cp generalsmd-vc6-artifacts/W3DViewZH.exe generalsmd-vc6-release/W3DViewZHv.exe | ||
cp generalsmd-vc6-artifacts/WorldBuilderZH.exe generalsmd-vc6-release/WorldBuilderZHv.exe | ||
zip -j generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip generalsmd-vc6-release/* | ||
|
||
# GeneralsMD win32 | ||
- name: Download GeneralsMD Win32 Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: GeneralsMD-win32+t+e | ||
path: generalsmd-win32-artifacts | ||
|
||
- name: Prepare and Zip GeneralsMD Win32 | ||
run: | | ||
mkdir generalsmd-win32-release | ||
cp generalsmd-win32-artifacts/generalszh.exe generalsmd-win32-release/GeneralsZHv.exe | ||
cp generalsmd-win32-artifacts/W3DViewZH.exe generalsmd-win32-release/W3DViewZHv.exe | ||
cp generalsmd-win32-artifacts/WorldBuilderZH.exe generalsmd-win32-release/WorldBuilderZHv.exe | ||
zip -j generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip generalsmd-win32-release/* | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ steps.next_version.outputs.next_tag }} | ||
name: ${{ steps.next_version.outputs.next_tag }} | ||
prerelease: ${{ github.event.inputs.pre-release == 'true' }} | ||
body: | | ||
## Build notes | ||
|
||
- **VC6 builds**: May be less compatible with modern systems, but guarantee compatibility with the original binary for multiplayer. | ||
- **Win32 builds**: Offer better compatibility with modern systems, but multiplayer will only work with other win32 builds. | ||
|
||
### Known issues | ||
|
||
- Fullscreen execution can freeze the game. For that case, you should add the `-win` parameter to run the game in windowed mode. | ||
|
||
### Changelog | ||
${{ steps.changelog.outputs.commits }} | ||
files: | | ||
generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip | ||
generals-win32-${{ steps.next_version.outputs.next_tag }}.zip | ||
generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip | ||
generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Clean up release folders | ||
if: always() | ||
run: | | ||
rm -rf generals-vc6-release generals-win32-release generalsmd-vc6-release generalsmd-win32-release | ||
rm -rf generals-vc6-artifacts generals-win32-artifacts generalsmd-vc6-artifacts generalsmd-win32-artifacts | ||
rm -f generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip | ||
rm -f generals-win32-${{ steps.next_version.outputs.next_tag }}.zip | ||
rm -f generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip | ||
rm -f generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this version value chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a random value and can be set whatever we want to.