Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
build: add development builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Oct 31, 2023
1 parent 5b6c7af commit c4db232
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 99 deletions.
13 changes: 13 additions & 0 deletions .github/actions/get_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Get the current version'
runs:
outputs:
version:
description: 'Repository version'
value: ${{ steps.get_version.outputs.VERSION }}
using: composite
steps:
- name: 'Extract tag name'
id: get_version
run: |
echo {VERSION}={$(git describe --always --abbrev=7 --tags)} >> $GITHUB_OUTPUT
shell: sh
21 changes: 21 additions & 0 deletions .github/actions/prepare_changelog/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Prepare changelog'
runs:
using: composite
outputs:
version:
description: 'Changelog'
value: ${{ steps.prepare_changelog.outputs.CHANGELOG }}
steps:
- name: 'Prepare changelog'
id: prepare_changelog
run: |
python3 -c '''
import re
from pathlib import Path
sections = [s for s in Path("CHANGELOG.md").read_text().split("\n\n") if re.search("- \w", s)]
if sections:
section = sections[0]
print("\n".join(line for line in section.splitlines() if not line.startswith("#")))
''' > /tmp/changes.txt
echo {VERSION}={$(cat /tmp/changes.txt)} >> $GITHUB_OUTPUT
shell: bash
3 changes: 1 addition & 2 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0
fetch-tags: true

- name: Build Docker image
run: |
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/build_game_win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
- workflow_call

jobs:
build_game_win:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-tags: true

- name: 'Install dependencies'
run: |
echo "$GITHUB_CONTEXT"
sudo apt-get update
sudo apt-get install -y make moby-engine moby-cli
shell: sh

- name: 'Build the game'
run: |
make clean release
mkdir -p out/
cp build/win/*.exe out/
cp build/win/*.dll out/
cp -r bin/* out/
shell: sh

- name: 'Upload the artifact'
uses: actions/upload-artifact@v1
with:
name: game_win
path: out/

package_game_win:
name: 'Package'
runs-on: ubuntu-latest
needs:
- build_game_win
steps:
- name: 'Download built assets'
uses: actions/download-artifact@v1
with:
name: game_win
path: artifacts/

- name: 'Install dependencies'
run: |
sudo apt-get update
sudo apt-get install -y make p7zip-full
shell: sh

- name: 'Package the game'
run: |
mkdir -p out
cd artifacts
7z a ../out/game-win.zip *
shell: sh

- name: 'Upload the artifact'
uses: actions/upload-artifact@v1
with:
name: game_win_zip
path: out/game-win.zip
3 changes: 1 addition & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0
fetch-tags: true

- name: Install dependencies
run: |
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish a prerelease

permissions:
contents: write

on:
push:
branch: develop

jobs:
package_prerelease:
name: 'Create a prerelease'
uses: ./.github/workflows/release.yml
with:
draft: false
prerelease: true
122 changes: 27 additions & 95 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Publish a new release

permissions:
Expand All @@ -8,134 +7,67 @@ on:
push:
branch: stable
tags:
- 'v?[0-9]*'
- 'v?[0-9]*'
workflow_call:
inputs:
draft:
description: 'Draft'
release_name:
description: 'Release name'
required: true
default: false
type: boolean
prerelease:
description: 'Prerelease'
required: true
type: boolean
workflow_dispatch:
inputs:
default: 'Release ${{ github.ref_name }}'
type: string
draft:
description: 'Draft'
required: true
default: true
default: false
type: boolean
prerelease:
description: 'Prerelease'
required: true
default: false
type: boolean

jobs:
publish_release:
name: Create a GitHub release
name: 'Create a GitHub release'
runs-on: ubuntu-latest
needs: [package_game_win]
needs:
- package_game_win
steps:
- name: 'Download built assets'
uses: actions/download-artifact@v1
with:
name: game_win_zip
path: artifacts/

- name: Checkout code
uses: actions/checkout@v3
with:
path: .
fetch-depth: 0
fetch-tags: true

- name: Download built game asset
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-win-all
- name: 'Prepare the changelog'
id: prepare_changelog
uses: ./.github/actions/prepare_changelog

- name: Extract tag name
- name: 'Get version'
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=7 --tags)
uses: ./.github/actions/get_version

- name: Rename assets
- name: 'Prepare for the release'
run: |
echo ${{steps.prepare_changelog.outputs.CHANGELOG }} >artifacts/changes.txt
mv artifacts/game-win.zip artifacts/TR2X-${{ steps.get_version.outputs.VERSION }}-Windows.zip
- name: Generate Changelog
run: |
python3 -c '''
import re
from pathlib import Path
sections = [s for s in Path("CHANGELOG.md").read_text().split("\n\n") if re.search("- \w", s)]
if sections:
section = sections[0]
print("\n".join(line for line in section.splitlines() if not line.startswith("#")))
''' > artifacts/changes.txt
- name: Release
- name: 'Publish the release'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref_name }}
name: ${{ inputs.release_name }}
body_path: artifacts/changes.txt
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
fail_on_unmatched_files: true
files: |
artifacts/TR2X-${{ steps.get_version.outputs.VERSION }}-Windows.zip
build_game_win:
name: Build the game (Windows)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: .
fetch-depth: 0

- name: Install dependencies
run: |
echo "$GITHUB_CONTEXT"
sudo apt-get update
sudo apt-get install -y make moby-engine moby-cli
- name: Build the game
run: |
make clean release
mkdir out/
cp build/win/*.exe out/
cp build/win/*.dll out/
cp -r bin/* out/
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-win
path: out/

package_game_win:
name: Package the game (Windows)
needs: [build_game_win]
runs-on: ubuntu-latest
steps:
- name: Download built game assets
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-win

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make p7zip-full
- name: Package the game
run: |
mkdir out
cd artifacts
7z a ../out/game-win.zip *
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-win-all
path: out/game-win.zip
name: 'Package the game (Windows)'
uses: ./.github/workflows/build_game_win.yml

0 comments on commit c4db232

Please sign in to comment.