Skip to content

Create a snapshot release #100

Create a snapshot release

Create a snapshot release #100

Workflow file for this run

name: CI
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
echo "=== Before pruning ==="
df -h
sudo rm -rf /opt || true
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 timedatectl set-timezone Europe/Moscow
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 32-bit 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
bash ./game/bundle/scripts/mkZip.bash
- uses: actions/upload-artifact@v4
with:
name: doom2df-win32
path: doom2df-win32.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-win32.zip, doom2df-android.apk
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ env.RELEASE_NAME }}
bodyFile: release_body
tag: ${{ env.RELEASE_NAME }}
allowUpdates: false
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true