Skip to content

Commit

Permalink
Merge pull request #37 from grillo-delmal/nightly_workflow
Browse files Browse the repository at this point in the history
Add nightly build workflow
  • Loading branch information
ExpiredPopsicle authored Oct 27, 2024
2 parents f581656 + f6defe1 commit e5687d5
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/check_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check for updates

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
release-check:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
run_nightly_build: ${{ steps.check.outputs.different_hash }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Check if there was a nightly build for the latest commit
id: check
run: |
set -e
[ "$(git rev-parse nightly)" == "$(git rev-parse HEAD~0)" ] || echo "different_hash=true" >> $GITHUB_OUTPUT
run-nightly-build:
needs: release-check
if: needs.release-check.outputs.run_nightly_build
uses: ./.github/workflows/nightly.yml
secrets: inherit
72 changes: 72 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Nightly build

on:
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
container: debian:bookworm

steps:
# Install git.
- name: Git
run: |
apt-get update
apt-get install -y git
# check out git repository.
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: '0'
fetch-tags: true

- name: Set nightly version in app
run: |
git config --global --add safe.directory /__w/SnekStudio/SnekStudio
sed -i "s/config\/name=.*/config\/name=\"SnekStudioNightly\"/" project.godot
sed -i "s/config\/version=.*/config\/version=\"$(git describe --tags --exclude nightly | cut -c2-)\"/" project.godot
# Do the build.
- name: Build
run: |
Build/run_this_inside_debian_container_to_build.bsh
- name: 🏷️ Create/update nightly tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/nightly',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/nightly',
sha: context.sha
});
})
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: nightly
assets: |
*
- name: Release to nightly tag
uses: softprops/action-gh-release@v2
with:
name: Nightly build
body: Auto generated release
tag_name: nightly
prerelease: true
files: "Build/Builds/Dist/SnekStudio_*"

0 comments on commit e5687d5

Please sign in to comment.