Porytiles Nightly Release #381
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/request-action@v2.x | |
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-0x-linux-amd64: | |
name: Release a nightly statically linked 0.x linux-amd64 binary | |
runs-on: ubuntu-latest | |
needs: [create-release-tag] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- name: Install GCC and other build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install zlib1g-dev | |
sudo apt-get install libpng-dev | |
sudo apt-get install cmake | |
sudo apt-get install g++ | |
g++ --version | |
- 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-gcc nightly-${{github.sha}} . | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: nightly-${{github.sha}} | |
files: porytiles-linux-amd64-gcc.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
nightly-release-0x-macos-arm64: | |
name: Release a nightly dynamically linked 0.x 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 and dependencies | |
run: | | |
brew update | |
brew install zlib || true | |
brew install libpng || true | |
brew install llvm || true | |
/opt/homebrew/opt/llvm/bin/clang++ --version | |
/opt/homebrew/opt/llvm/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-0x-linux-amd64, nightly-release-0x-macos-arm64] | |
if: needs.check-already-built.outputs.last_sha != github.sha | |
steps: | |
- uses: dev-drprasad/delete-older-releases@v0.3.2 | |
with: | |
keep_latest: 1 | |
delete_tag_pattern: nightly-.* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |