Skip to content

nightly-trigger

nightly-trigger #63

Workflow file for this run

name: Nightly build
on:
workflow_dispatch:
workflow_call:
repository_dispatch:
types: [nightly-trigger]
jobs:
build:
runs-on: ubuntu-latest
container: debian:trixie
outputs:
version: ${{ steps.ver_exp.outputs.version }}
steps:
# Install git.
- name: Git
run: |
apt-get update
apt-get install -y git nodejs
# 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
# set the version for flatpak
- name: Version Export
id: ver_exp
shell: bash
run: |
echo "VERSION=$(git describe --tags --exclude nightly | cut -c2-)" >> $GITHUB_OUTPUT
- name: Upload built files as artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: Build/Builds/Dist/
flatpak:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-24.08
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: "0"
fetch-tags: true
- name: Download build output
uses: actions/download-artifact@v4
with:
name: build-output
path: Build/Builds/Dist/
# i wish we didn't have to do this but flathub infra containers don't have package managers
# also since it doesn't have a pm you've got to use a container to hackily setup binfmt
- name: Install deps
run: |
# Use the static binaries because it's unable to use a package manager
curl https://download.docker.com/linux/static/stable/x86_64/docker-28.3.3.tgz --output ./docker.tgz
tar xzvf docker.tgz
mv docker/* /usr/bin
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: set VERSION
run: echo "VERSION=${{ needs.build.outputs.version }}" >> $GITHUB_ENV
- name: setup flatpak files
run: |
cp ./flatpak/* .
cp -r ./Core/UI/Images/icons .
sed -i "s|AMD64_ARCHIVE|Build/Builds/Dist/SnekStudio_Linux-x86_64_${VERSION}.tar.gz|g" com.snekstudio.Snekstudio.yaml
sed -i "s|ARM64_ARCHIVE|Build/Builds/Dist/SnekStudio_Linux-arm64_${VERSION}.tar.gz|g" com.snekstudio.Snekstudio.yaml
- name: Build x64
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: SnekStudio_${{ needs.build.outputs.version }}_x86_64.flatpak
manifest-path: com.snekstudio.Snekstudio.yaml
cache: false # caching would mean we have to make Version more verbose
upload-artifact: false # we're going to push them to a release why add em as artifacts
arch: x86_64
- name: Build arm64
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: SnekStudio_${{ needs.build.outputs.version }}_aarch64.flatpak
manifest-path: com.snekstudio.Snekstudio.yaml
cache: false
upload-artifact: false
arch: aarch64
- name: copy to dist
run: |
cp SnekStudio_*.flatpak Build/Builds/Dist/
- name: Upload built files as artifact
uses: actions/upload-artifact@v4
with:
name: build-output-flatpak
path: Build/Builds/Dist/*.flatpak
publish:
needs: [build, flatpak]
runs-on: ubuntu-latest
container: debian:trixie
steps:
# Install git.
- name: Git
run: |
apt-get update
apt-get install -y git nodejs
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: "0"
fetch-tags: true
- name: Download build output - binaries
uses: actions/download-artifact@v4
with:
name: build-output
path: Build/Builds/Dist/
- name: Download build output - flatpak
uses: actions/download-artifact@v4
with:
name: build-output-flatpak
path: Build/Builds/Dist/
- 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
fail-if-no-assets: false
fail-if-no-release: false
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_*"