Create a snapshot release #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a snapshot release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nixbuild/nix-quick-install-action@v29 | |
- name: Remove unnecessary packages | |
run: | # stolen from https://github.com/easimon/maximize-build-space and https://github.com/actions/runner-images/issues/2840 | |
echo "=== Before pruning ===" | |
df -h | |
sudo rm -rf /opt || : | |
sudo rm -rf /usr/share/dotnet || : | |
sudo rm -rf "/usr/local/share/boost" || : | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || : | |
echo | |
echo "=== After pruning ===" | |
df -h | |
# To make the environment in the flake's devShell available to future steps: | |
- uses: rrbutani/use-nix-shell-action@v1 | |
with: | |
devShell: .#default | |
- name: Calculate cache hash based on nixpkgs' revision | |
run: | | |
NIXPKGS_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."nixpkgs".locked.rev') | |
echo "NIXPKGS_REV=$NIXPKGS_REV" >> "$GITHUB_ENV" | |
- name: Restore cache | |
uses: nix-community/cache-nix-action/[email protected] | |
with: | |
primary-key: build-${{ runner.os }}-${{ env.NIXPKGS_REV }} | |
fail-on: primary-key.miss | |
- name: Update Doom2D related inputs and populate environment variables | |
run: | | |
sudo apt-get update && sudo apt-get install tzdata locales -y | |
sudo timedatectl set-timezone Europe/Moscow | |
sudo localedef -f UTF-8 -i /usr/share/i18n/locales/ru_RU /usr/lib/locale/ru_RU.UTF-8 | |
sudo echo 'ru_RU.UTF-8 UTF-8' | sudo tee -a /etc/locale.gen > /dev/null | |
sudo mkdir -p /usr/local/share/i18n | |
sudo touch /usr/local/share/i18n/SUPPORTED | |
sudo echo 'ru_RU.UTF-8 UTF-8' | sudo tee -a /usr/local/share/i18n/SUPPORTED > /dev/null | |
sudo locale-gen ru_RU.UTF-8 | |
sudo locale-gen ru_RU | |
sudo locale-gen | |
locale -a | |
locale | |
sudo update-locale LANG=ru_RU.UTF-8 | |
bash ./game/bundle/scripts/mkEnv.bash | |
- name: Build debug APK | |
env: | |
ASSETS_SOUNDFONT: 1 | |
run: | | |
bash ./game/bundle/scripts/mkAndroid.bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doom2df-android | |
path: result | |
if-no-files-found: error | |
- name: Build Windows x86 ZIP bundle | |
env: | |
D2DF_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }} | |
RES_LAST_COMMIT_DATE: ${{ env.RES_LAST_COMMIT_DATE }} | |
EDITOR_LAST_COMMIT_DATE: ${{ env.EDITOR_LAST_COMMIT_DATE }} | |
DISTRO_CONTENT_CREATION_DATE: ${{ env.DISTRO_CONTENT_CREATION_DATE }} | |
run: | | |
export D2DF_LAST_COMMIT_DATE=$D2DF_LAST_COMMIT_DATE | |
export RES_LAST_COMMIT_DATE=$RES_LAST_COMMIT_DATE | |
export EDITOR_LAST_COMMIT_DATE=$EDITOR_LAST_COMMIT_DATE | |
export DISTRO_CONTENT_CREATION_DATE=$DISTRO_CONTENT_CREATION_DATE | |
export BUILD_ARCH=mingw32 | |
export IS_WINDOWS=1 | |
bash ./game/bundle/scripts/mkZip.bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doom2df-mingw32 | |
path: doom2df-mingw32.zip | |
- name: Build Windows x86_64 ZIP bundle | |
env: | |
D2DF_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }} | |
RES_LAST_COMMIT_DATE: ${{ env.RES_LAST_COMMIT_DATE }} | |
EDITOR_LAST_COMMIT_DATE: ${{ env.EDITOR_LAST_COMMIT_DATE }} | |
DISTRO_CONTENT_CREATION_DATE: ${{ env.DISTRO_CONTENT_CREATION_DATE }} | |
run: | | |
export D2DF_LAST_COMMIT_DATE=$D2DF_LAST_COMMIT_DATE | |
export RES_LAST_COMMIT_DATE=$RES_LAST_COMMIT_DATE | |
export EDITOR_LAST_COMMIT_DATE=$EDITOR_LAST_COMMIT_DATE | |
export DISTRO_CONTENT_CREATION_DATE=$DISTRO_CONTENT_CREATION_DATE | |
export BUILD_ARCH=mingw64 | |
export IS_WINDOWS=1 | |
bash ./game/bundle/scripts/mkZip.bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doom2df-mingw64 | |
path: doom2df-mingw64.zip | |
- name: Build MacOS x86_64 ZIP bundle | |
env: | |
D2DF_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }} | |
RES_LAST_COMMIT_DATE: ${{ env.RES_LAST_COMMIT_DATE }} | |
EDITOR_LAST_COMMIT_DATE: ${{ env.EDITOR_LAST_COMMIT_DATE }} | |
DISTRO_CONTENT_CREATION_DATE: ${{ env.DISTRO_CONTENT_CREATION_DATE }} | |
run: | | |
export D2DF_LAST_COMMIT_DATE=$D2DF_LAST_COMMIT_DATE | |
export RES_LAST_COMMIT_DATE=$RES_LAST_COMMIT_DATE | |
export EDITOR_LAST_COMMIT_DATE=$EDITOR_LAST_COMMIT_DATE | |
export DISTRO_CONTENT_CREATION_DATE=$DISTRO_CONTENT_CREATION_DATE | |
export BUILD_ARCH=x86_64-apple-darwin | |
bash ./game/bundle/scripts/mkZip.bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doom2df-x86_64-apple-darwin | |
path: doom2df-x86_64-apple-darwin.zip | |
- name: Build MacOS aarch64 ZIP bundle | |
env: | |
D2DF_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }} | |
RES_LAST_COMMIT_DATE: ${{ env.RES_LAST_COMMIT_DATE }} | |
EDITOR_LAST_COMMIT_DATE: ${{ env.EDITOR_LAST_COMMIT_DATE }} | |
DISTRO_CONTENT_CREATION_DATE: ${{ env.DISTRO_CONTENT_CREATION_DATE }} | |
run: | | |
export D2DF_LAST_COMMIT_DATE=$D2DF_LAST_COMMIT_DATE | |
export RES_LAST_COMMIT_DATE=$RES_LAST_COMMIT_DATE | |
export EDITOR_LAST_COMMIT_DATE=$EDITOR_LAST_COMMIT_DATE | |
export DISTRO_CONTENT_CREATION_DATE=$DISTRO_CONTENT_CREATION_DATE | |
export BUILD_ARCH=arm64-apple-darwin | |
bash ./game/bundle/scripts/mkZip.bash | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doom2df-arm64-apple-darwin | |
path: doom2df-arm64-apple-darwin.zip | |
if-no-files-found: error | |
- name: Calculate new build number | |
run: | | |
GITHUB_RESPONSE_FILE=github_response | |
TODAY=$(date +'%Y-%m-%d') | |
curl \ | |
-H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }}/releases \ | |
-H "Authorization: ${{ secrets.GITHUB_TOKEN }}" \ | |
> $GITHUB_RESPONSE_FILE | |
TODAY_RELEASES_COUNT=$(jq --arg TODAY $TODAY '[.[] | select(.prerelease == true and (.created_at | startswith($TODAY) ) )] | length' $GITHUB_RESPONSE_FILE) | |
THIS_RELEASE_COUNT=$(( $TODAY_RELEASES_COUNT + 1 )) | |
RELEASE_PREFIX="0.667b" | |
RELEASE_NAME="${RELEASE_PREFIX}-$(date +'%Y.%m.%d')-$THIS_RELEASE_COUNT" | |
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | |
- uses: ncipollo/release-action@v1 | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch'}} | |
with: | |
artifacts: doom2df-mingw32.zip, doom2df-android.apk, doom2df-mingw64.zip, doom2df-x86_64-apple-darwin.zip, doom2df-arm64-apple-darwin.zip | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ env.RELEASE_NAME }} | |
bodyFile: release_body | |
tag: ${{ env.RELEASE_NAME }} | |
allowUpdates: false | |
artifactErrorsFailBuild: true | |
prerelease: true | |
replacesArtifacts: true |