mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-02-02 03:31:52 +00:00
build: add development builds
This commit is contained in:
parent
5b6c7af52a
commit
acb5a69414
14
.github/actions/get_version/action.yml
vendored
Normal file
14
.github/actions/get_version/action.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: 'Get the current version'
|
||||
outputs:
|
||||
version:
|
||||
description: 'Repository version'
|
||||
value: ${{ steps.get_version.outputs.VERSION }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: 'Extract tag name'
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(git describe --always --abbrev=7 --tags --exclude latest)
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
24
.github/actions/prepare_changelog/action.yml
vendored
Normal file
24
.github/actions/prepare_changelog/action.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: 'Prepare changelog'
|
||||
outputs:
|
||||
changelog:
|
||||
description: 'Changelog'
|
||||
value: ${{ steps.prepare_changelog.outputs.CHANGELOG }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: 'Prepare changelog'
|
||||
id: prepare_changelog
|
||||
run: |
|
||||
echo 'CHANGELOG<<EOF' >> "$GITHUB_OUTPUT"
|
||||
|
||||
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("#")))
|
||||
''' >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo EOF >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
8
.github/workflows/build_docker.yml
vendored
8
.github/workflows/build_docker.yml
vendored
@ -8,19 +8,19 @@ jobs:
|
||||
name: Build Docker toolchain
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Login to Docker Hub
|
||||
- name: 'Login to Docker Hub'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Checkout code
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: .
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Build Docker image
|
||||
- name: 'Build Docker image'
|
||||
run: |
|
||||
docker build -t "rrdash/tr2x:latest" . -f docker/game-win/Dockerfile
|
||||
docker push "rrdash/tr2x:latest"
|
||||
|
66
.github/workflows/build_game_win.yml
vendored
Normal file
66
.github/workflows/build_game_win.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
on:
|
||||
- workflow_call
|
||||
|
||||
jobs:
|
||||
build_game_win:
|
||||
name: 'Build'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: .
|
||||
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 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
|
10
.github/workflows/lint.yml
vendored
10
.github/workflows/lint.yml
vendored
@ -9,13 +9,13 @@ jobs:
|
||||
name: Run code linters
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: .
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Install dependencies
|
||||
- name: 'Install dependencies'
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee -a /etc/apt/sources.list
|
||||
@ -26,13 +26,13 @@ jobs:
|
||||
sudo apt-get install -y make python3-pip
|
||||
sudo python3 -m pip install pyjson5
|
||||
|
||||
- name: Check imports
|
||||
- name: 'Check imports'
|
||||
run: |
|
||||
git add -A
|
||||
python3 tools/sort_imports
|
||||
git diff --exit-code || ( echo 'Please run `make imports` and commit the changes.'; exit 1 )
|
||||
|
||||
- name: Check formatted code differences
|
||||
- name: 'Check formatted code differences'
|
||||
run: |
|
||||
make lint
|
||||
git diff --exit-code || ( echo 'Please run `make lint` and commit the changes.'; exit 1 )
|
||||
|
30
.github/workflows/prerelease.yml
vendored
Normal file
30
.github/workflows/prerelease.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: Publish a prerelease
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branch: develop
|
||||
|
||||
jobs:
|
||||
tag_latest:
|
||||
name: 'Tag the repository'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 'Update the tag'
|
||||
uses: EndBug/latest-tag@latest
|
||||
|
||||
publish_prerelease:
|
||||
name: 'Create a prerelease'
|
||||
needs:
|
||||
- tag_latest
|
||||
uses: ./.github/workflows/release.yml
|
||||
with:
|
||||
release_name: 'Development snapshot'
|
||||
draft: false
|
||||
prerelease: true
|
||||
tag_name: latest
|
131
.github/workflows/release.yml
vendored
131
.github/workflows/release.yml
vendored
@ -1,4 +1,3 @@
|
||||
|
||||
name: Publish a new release
|
||||
|
||||
permissions:
|
||||
@ -8,9 +7,19 @@ on:
|
||||
push:
|
||||
branch: stable
|
||||
tags:
|
||||
- 'v?[0-9]*'
|
||||
- 'v?[0-9]*'
|
||||
workflow_call:
|
||||
inputs:
|
||||
release_name:
|
||||
description: 'Release name'
|
||||
required: true
|
||||
default: 'Release ${{ github.ref_name }}'
|
||||
type: string
|
||||
tag_name:
|
||||
description: 'Tag name'
|
||||
required: false
|
||||
default: '${{ github.ref }}'
|
||||
type: string
|
||||
draft:
|
||||
description: 'Draft'
|
||||
required: true
|
||||
@ -20,122 +29,60 @@ on:
|
||||
description: 'Prerelease'
|
||||
required: true
|
||||
type: boolean
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
draft:
|
||||
description: 'Draft'
|
||||
required: true
|
||||
default: true
|
||||
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: Checkout code
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: .
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Download built game asset
|
||||
- name: 'Download built assets'
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: game_win_zip
|
||||
path: artifacts/
|
||||
name: game-win-all
|
||||
|
||||
- name: Extract tag name
|
||||
- name: 'Prepare the changelog'
|
||||
id: prepare_changelog
|
||||
uses: ./.github/actions/prepare_changelog
|
||||
|
||||
- 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: |
|
||||
mv artifacts/game-win.zip artifacts/TR2X-${{ steps.get_version.outputs.VERSION }}-Windows.zip
|
||||
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: 'Delete old release assets'
|
||||
uses: mknejp/delete-release-assets@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
tag: ${{ inputs.tag_name }}
|
||||
assets: '*.*'
|
||||
|
||||
- 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
|
||||
tag_name: ${{ inputs.tag_name }}
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user