Porytiles Nightly Release #290
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
name: Porytiles Nightly Release | |
on: | |
schedule: | |
- cron: "00 05 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
check-already-built: | |
name: Check if we already built a nightly from this commit SHA | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: octokit/[email protected] | |
id: check_last_run | |
with: | |
route: GET /repos/${{github.repository}}/actions/workflows/nightly_release.yml/runs?per_page=1&status=completed | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: "echo Last nightly build: ${{fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha}}" | |
outputs: | |
last_sha: ${{fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha}} | |
create-release-tag: | |
name: Create a tag for this release | |
runs-on: ubuntu-latest | |
needs: [check-already-built] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: develop | |
- uses: rickstaa/action-create-tag@v1 | |
id: "tag_create" | |
with: | |
tag: nightly-${{github.sha}} | |
tag_exists_error: true | |
nightly-release-linux-amd64: | |
name: Release a nightly statically linked linux-amd64 binary | |
runs-on: ubuntu-latest | |
needs: [create-release-tag] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- name: Install Clang+LLVM 16 and dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install zlib1g-dev | |
sudo apt-get install libpng-dev | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 16 all | |
clang++-16 --version | |
clang++-16 -v | |
- name: Checkout new Porytiles nightly tag | |
uses: actions/checkout@v4 | |
with: | |
ref: nightly-${{github.sha}} | |
- name: Create release package | |
run: | | |
./Scripts/package.sh linux-amd64 nightly-${{github.sha}} . | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: nightly-${{github.sha}} | |
files: porytiles-linux-amd64.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
nightly-release-macos-arm64: | |
name: Release a nightly dynamically linked macos-arm64 binary | |
runs-on: macos-latest | |
# GitHub removed Intel Mac runners, so macos-latest is now arm64 | |
needs: [create-release-tag] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- name: Install Clang+LLVM 16 and dependencies | |
run: | | |
brew update | |
brew install zlib || true | |
brew install libpng || true | |
brew install llvm@16 || true | |
/opt/homebrew/opt/llvm@16/bin/clang++ --version | |
/opt/homebrew/opt/llvm@16/bin/clang++ -v | |
- name: Checkout new Porytiles nightly tag | |
uses: actions/checkout@v4 | |
with: | |
ref: nightly-${{github.sha}} | |
- name: Create release package | |
run: | | |
./Scripts/package.sh macos-arm64 nightly-${{github.sha}} . | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: nightly-${{github.sha}} | |
files: porytiles-macos-arm64.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
prune-old-nightlies: | |
name: Only keep the latest nightly build | |
runs-on: ubuntu-latest | |
needs: [nightly-release-linux-amd64, nightly-release-macos-arm64] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 1 | |
delete_tag_pattern: nightly-.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |