-
Notifications
You must be signed in to change notification settings - Fork 14
130 lines (124 loc) · 4.25 KB
/
build.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build Canabalt
on:
push:
workflow_dispatch:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
RELEASE_TAG: ${{startsWith(github.ref, 'refs/tags/') && github.ref_name || 'bleeding'}}
jobs:
create-latest:
runs-on: ubuntu-latest
steps:
- name: Github Releases Bleeding Upload
uses: marvinpinto/[email protected]
with:
repo_token: "${{ github.token }}"
automatic_release_tag: "${{env.RELEASE_TAG}}"
prerelease: ${{startsWith(env.RELEASE_TAG, 'bleeding') && 'true' || 'false'}}
download_haxe:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.3.3
- name: Retrieve Haxelib actions cache
uses: actions/cache@v4
with:
path: .haxelib
key: haxelib-${{ hashFiles('hmm.json') }}-${{ env.BRANCH_NAME }}
- name: Install HMM
run: |
haxelib install hmm --quiet
- name: Download Haxelibs
run: |
haxelib run hmm install --quiet
build:
needs: download_haxe
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: html5
butler: linux
- os: ubuntu-latest
target: linux
butler: linux
- os: windows-latest
target: windows
butler: windows
- os: macos-latest
target: macos # needs to be macos! not just mac !
butler: darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.3.3
- name: Get haxelibs
uses: actions/cache/restore@v3
with:
path: .haxelib
key: haxelib-${{ hashFiles('hmm.json') }}-${{ env.BRANCH_NAME }}
- name: Restore build cache
if: matrix.target != 'html5'
uses: actions/cache@v4
with:
path: export/*/obj/
key: cpp-${{matrix.target}}-${{ env.BRANCH_NAME }}
- run: haxelib run hmm install --quiet
- name: Build
run: |
haxelib run lime build ${{matrix.target}} -release -DNG_API=${{ secrets.NG_API }} -DNG_ENC=${{ secrets.NG_ENC }}
- name: Obfuscate the Javascript
if: matrix.target == 'html5'
uses: ninjamuffin99/[email protected]
with:
path: export/html5/bin/canabalt.js
- name: 7Zip Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install p7zip-full p7zip-rar
- name: Install and extract butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/${{matrix.butler}}-amd64/LATEST/archive/default
7z e butler.zip
- run: chmod +x butler
if: matrix.os == 'ubuntu-latest'
- name: Login to itch.io
run: |
./butler login
./butler -V
- name: Push to itch.io
run: |
./butler push export/*/bin ninja-muffin24/canabalt-hf:${{ matrix.target }}-${{env.RELEASE_TAG}}-${{env.BRANCH_NAME}}
shell: bash
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- run: tar cf - export/${{matrix.target}}/bin/ | gzip > canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.tar.gz
if: matrix.target == 'linux'
- uses: vimtor/[email protected] # too lazy to figure out 7z grrr...
if: matrix.target != 'linux'
with:
files: export/${{matrix.target}}/bin/
dest: canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.zip
- name: Upload build to Github releases
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release upload ${{env.RELEASE_TAG}} canabalt-${{matrix.target}}-${{ steps.date.outputs.date }}-${{env.BRANCH_NAME}}.* --clobber
shell: bash