Skip to content

Build and Deploy Nightly Builds #36

Build and Deploy Nightly Builds

Build and Deploy Nightly Builds #36

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
schedule:
- cron: '0 0 * * *' # Every day at midnight UTC
workflow_dispatch:
inputs:
NIGHTLY:
description: 'Run as a nightly build'
default: false
required: true
type: boolean
run-name: "${{ (github.event_name == 'schedule' || inputs.NIGHTLY == true) && 'Build and Deploy Nightly Builds' || github.event.head_commit.message}}"
jobs:
check-skippable:
name: Check Skippable
runs-on: ubuntu-24.04
outputs:
skip: ${{ steps.set-skippable.outputs.skippable || 'false' }}
steps:
- uses: actions/checkout@v4
- name: Check and set skippable
id: set-skippable
continue-on-error: true
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
git fetch origin tag nightly
LAST_COMMIT_HASH=$(git rev-list -n 1 nightly)
if [ "$(git rev-parse HEAD)" = "$LAST_COMMIT_HASH" ]; then
echo "::notice::No new commits since last nightly build, skipping this build."
echo "skippable=true" >> $GITHUB_OUTPUT
fi
else
echo "skippable=false" >> $GITHUB_OUTPUT
fi
build-macos:
needs: check-skippable
if: needs.check-skippable.outputs.skip != 'true'
uses: ./.github/workflows/cppcmake-macos.yml
secrets: inherit
with:
NIGHTLY: ${{ github.event_name == 'schedule' || inputs.NIGHTLY == true }}
build-ubuntu:
needs: check-skippable
if: needs.check-skippable.outputs.skip != 'true'
uses: ./.github/workflows/cppcmake-ubuntu.yml
with:
NIGHTLY: ${{ github.event_name == 'schedule' || inputs.NIGHTLY == true }}
build-windows:
needs: check-skippable
if: needs.check-skippable.outputs.skip != 'true'
uses: ./.github/workflows/cppcmake-windows.yml
secrets: inherit
with:
NIGHTLY: ${{ github.event_name == 'schedule' || inputs.NIGHTLY == true }}
release:
if: github.event_name != 'pull_request'
needs: [build-macos, build-ubuntu, build-windows]
name: Release
runs-on: ubuntu-24.04
env:
GH_TOKEN: ${{ github.token }}
tag_name: ${{ (github.event_name == 'schedule' || inputs.NIGHTLY == true) && 'nightly' || 'continuous' }}
steps:
- name: Delete existing tag and release
run: gh release delete ${{ env.tag_name }} --cleanup-tag --yes --repo $GITHUB_REPOSITORY
continue-on-error: true
- run: mkdir -v target
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: target
- name: Remove unsigned Windows build
run: rm -rfv target/*unsigned*
- run: find target -type f -exec mv -v {} target \;
- name: Unarchive Windows's build artifacts
run: for f in target/*.zip; do unzip -d target/ "$f" && rm -v "$f"; done
- name: Release
uses: softprops/action-gh-release@v2
with:
files: target/*
prerelease: true
tag_name: ${{ env.tag_name }}