-
Notifications
You must be signed in to change notification settings - Fork 3
116 lines (105 loc) · 3.73 KB
/
nightly_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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: |
./script/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: |
./script/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 }}