-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (101 loc) · 2.96 KB
/
release-packaging.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
name: Release Packaging
on:
workflow_dispatch:
# Ensure the build works on main
push:
branches: [main]
tags: ['*']
# Ensure the build works on each pull request
pull_request:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
check:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- name: Load dotenv
run: just ci-load-dotenv
- name: Check
run: just fmt
- name: Ensure version is equal to tag
if: startsWith(github.ref, 'refs/tags/')
run: |
[ "${{ env.game_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2
build:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- name: Load dotenv
run: just ci-load-dotenv
- name: Cache Godot
uses: actions/cache@v4
with:
path: |
~/.mkflower/bin
~/.local/share/godot/export_templates
key: ${{ env.godot_version }}
- name: Export
run: just export
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.game_name }}-v${{ env.game_version }}
path: dist/*
retention-days: 1
deploy:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [check]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- name: Load dotenv
run: just ci-load-dotenv
- name: Cache Godot
uses: actions/cache@v4
with:
path: |
~/.mkflower/bin
~/.local/share/godot/export_templates
key: ${{ env.godot_version }}
- name: Export
run: just export-web
# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail.
- name: Install rsync
run: |
sudo apt-get update && sudo apt-get install -y rsync
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/web
publish:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- name: Load dotenv
run: just ci-load-dotenv
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: ${{ env.game_name }}-v${{ env.game_version }}
path: dist/
skip_unpack: false
- name: Publish
run: just ci-publish
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
GITHUB_TOKEN: ${{ secrets.PAT }}