-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
119 lines (105 loc) · 3.74 KB
/
action.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
name: play-gitterra
description: This action will let you play GitTerra game in your repository
author: GitTerra Team
inputs:
deploy-destination:
description: "Base URL of the deployment destination"
required: false
fetch-depth:
description: "The depth of commits to fetch"
required: false
default: "100000"
branding:
icon: "map"
color: "blue"
runs:
using: "composite"
steps:
- run: echo "Let's play GitTerra game"
shell: "bash"
- name: Opening the scrolls of wisdom
uses: actions/checkout@v4
with:
path: "scrolls"
fetch-depth: ${{ inputs.fetch-depth }}
ref: ${{ github.ref }}
- name: Inviting a wizard from a distant land
id: cache-scc
uses: actions/cache@v4
env:
cache-name: our-wizard
with:
# we don't expect SCC to change, just use the same version all the time
path: wizard/
key: ${{ env.cache-name }}
- if: ${{ steps.cache-scc.outputs.cache-hit != 'true' }}
name: Providing transportation for a wizard if they are away
run: |
mkdir -p wizard
wget https://github.com/boyter/scc/releases/download/v3.2.0/scc_Linux_x86_64.tar.gz -O wizard/scc.gz
tar -C wizard/ -xvf wizard/scc.gz
shell: "bash"
- name: Transporting builders to the construction site
uses: actions/checkout@v4
with:
repository: "GitTerraGame/Play-GitTerra-Action"
path: "builders"
- name: Looking for a stash of existing tools
id: cache-npm
uses: actions/cache@v4
env:
cache-name: tool-stash
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('builders/package-lock.json') }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-
${{ env.cache-name }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Check the empty stash
continue-on-error: true
shell: "bash"
run: npm list
- name: Equipping builders with the tools
run: (cd builders && npm ci)
shell: "bash"
- name: Checking history archives
if: ${{ inputs.deploy-destination == '' }}
id: cache-history-restore
uses: actions/cache/restore@v4
env:
cache-name: history
with:
# we only expect history to change when the repository changes and only going forward
# it might be empty as caches get evicted after 7 days
# (@TODO replace with fetching back from the deployed map site)
path: history.json
key: ${{ env.cache-name }}-${{ github.ref }}-
- name: Checking the library that we build for the history records
if: ${{ inputs.deploy-destination != '' }}
run: curl -L -f -o history.json ${{ inputs.deploy-destination }}/history.json || true
shell: "bash"
continue-on-error: true
- name: Building the city of GitTerra
run: node builders/src/generateMap.js scrolls/ wizard/scc
shell: "bash"
- name: Updating history archives
if: ${{ inputs.deploy-destination == '' }}
id: cache-history-update
uses: actions/cache/save@v4
env:
cache-name: history
with:
# we only expect history to change when the repository changes and only going forward
# it might be empty as caches get evicted after 7 days
# (@TODO replace with fetching back from the deployed map site)
path: history.json
key: ${{ env.cache-name }}-${{ github.ref }}-${{ hashFiles('history.json') }}
- name: Archive the maps in the player's library
uses: actions/upload-artifact@v4
with:
name: gitterra
path: |
index.html
history.json