Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
with:
key: ${{ matrix.cfg.target }}

- name: Recreate the latest release for this commit
if: github.repository == 'openframeworks/projectGenerator' && github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/ci_latest_release.sh
- name: Determine Release
id: vars
shell: bash
Expand Down Expand Up @@ -141,6 +147,12 @@ jobs:
with:
key: ubuntu22-linux

- name: Recreate the latest release for this commit
if: github.repository == 'openframeworks/projectGenerator' && github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/ci_latest_release.sh
- name: Determine Release
shell: bash
run: |
Expand Down Expand Up @@ -219,6 +231,12 @@ jobs:
with:
key: arm64-linux

- name: Recreate the latest release for this commit
if: github.repository == 'openframeworks/projectGenerator' && github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/ci_latest_release.sh
- name: Determine Release
shell: bash
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
node-version: 26
- name: Setup
run: ./scripts/osx/setup_environment.sh
- name: Recreate the latest release for this commit
if: github.repository == 'openframeworks/projectGenerator' && github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/ci_latest_release.sh
- name: Determine Release
id: vars
shell: bash
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build-vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
zip
rsync
wget
- name: Recreate the latest release for this commit
if: github.repository == 'openframeworks/projectGenerator' && github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/ci_latest_release.sh
- name: Determine Release
id: vars
shell: bash
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/latest-release.yml

This file was deleted.

28 changes: 28 additions & 0 deletions scripts/ci_latest_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# master builds upload to the "latest" release. The first build job of a push recreates it at that
# commit, so its date and tag are this build's; jobs that start later (a runner can queue for half
# an hour) see the tag already there and leave it, so nothing already uploaded is deleted.
# Re-running an older master build doesn't touch a newer latest.

REPO="${GITHUB_REPOSITORY:?}"
SHA="${GITHUB_SHA:?}"

head=$(gh api "repos/$REPO/commits/master" --jq '.sha' 2>/dev/null || true)
if [ "$head" != "$SHA" ]; then
echo "${SHA:0:7} isn't the master head (${head:0:7}) - leaving latest"
exit 0
fi

current=$(gh api "repos/$REPO/git/ref/tags/latest" --jq '.object.sha' 2>/dev/null || true)
if [ "$current" = "$SHA" ]; then
echo "latest is already at ${SHA:0:7}"
exit 0
fi

echo "recreating latest at ${SHA:0:7} (was ${current:0:7})"
gh release delete latest --repo "$REPO" --cleanup-tag --yes || echo "no latest release yet"
# another build job may create it at the same moment
gh release create latest --repo "$REPO" --target "$SHA" --title latest --latest=false \
--notes "Latest master build from ${SHA:0:7} (copied to nightly every night). Files are added as each platform finishes building." \
|| gh release view latest --repo "$REPO" > /dev/null
Loading