-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from grillo-delmal/nightly_workflow
Add nightly build workflow
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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_*" |