generated from SteamDeckHomebrew/decky-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
162 lines (137 loc) · 5.5 KB
/
docker-image.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Build Junk-Store
on:
push:
branches:
- main
- development
paths:
- "**/*"
pull_request_target:
branches: ['*']
workflow_dispatch:
inputs:
plugin_override:
description: Whitespace-separated list of plugin names to be built and uploaded. Enter "#all" to build and upload all plugins. Leave blank to use the default behavior.
type: string
required: false
force_revision:
type: boolean
description: Force a revision for for a plugin upload (used to fix issues caused by CI.)
force_pnpm:
type: choice
description: Forces an update to pnpm lockfile version and or Decky Frontend Library. This is only to be used in "oh shit" situations. Otherwise defer to the plugin developer so that they can submit a fix/update.
default: 'none'
options:
- none
- pnpm
- dfl
- pnpm-dfl
env:
revision_force: ${{ inputs.force_revision }}
pnpm_force: ${{ inputs.force_pnpm }}
testing: ${{ inputs.test_build }}
testing_plugins: "Bluetooth ControllerTools SDH-AudioLoader SDH-CssLoader moondeck memory-deck Fantastic"
jobs:
build:
name: Build Junk-Store
runs-on: ubuntu-latest
environment:
name: ${{ (github.ref == 'refs/heads/main' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.plugin_override))) && 'env' || 'testing_env' }}
strategy:
fail-fast: false
env:
plugin: "Junk-Store"
steps:
- name: Checkout
if: ${{ !env.ACT }}
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Append hash to plugin version
if: ${{ github.event_name == 'pull_request_target' }}
run: |
echo "::notice::This run was triggered by a pull request. Appending the commit hash to the plugin version."
echo "::group::Appending hash to plugin $plugin"
PACKAGE_FILE="package.json"
SHA=$(cut -c1-7 <<< "${{ github.event.pull_request.head.sha || github.sha }}")
VERSION=$(jq -r '.version' $PACKAGE_FILE)
NEW_VERSION="$VERSION-$SHA"
echo "::notice::Going from $VERSION to $NEW_VERSION"
tmp=$(mktemp)
jq --arg newversion "$NEW_VERSION" '.version = $newversion' $PACKAGE_FILE > $tmp
mv $tmp $PACKAGE_FILE
echo "::endgroup::"
- name: Append revision to force update
if: ${{ env.revision_force == 'true' }}
run: |
echo "::notice::This run was manually to force an appended revision. Appending a revision to the plugin version."
echo "::group::Appending revision to plugin $plugin"
PACKAGE_FILE="package.json"
VERSION=$(jq -r '.version' $PACKAGE_FILE)
echo "Version: $VERSION"
VERSION_WO_REVISION=$(echo $VERSION | sed -e 's|-[^-]*$||')
echo "Version without revisions: $VERSION"
PREV_REVISION=$(echo $VERSION | sed -e 's|[0-9][0-9.]*[0-9]-||')
echo "Current revision: $PREV_REVISION"
if [[ "$PREV_REVISION" =~ "-" ]]; then
IS_REVISED=true
echo "Is revised"
else
IS_REVISED=false
echo "Is not revised"
fi
if [[ "$IS_REVISED" == "false" ]]; then
echo "Plugin is not revised, setting to revision 1."
REVISION="1"
echo "Revision: $REVISION"
NEW_VERSION="$VERSION-$REVISION"
else
REVISION=$(($PREV_REVISION + 1))
echo "Revision: $REVISION"
NEW_VERSION="$VERSION_WO_REVISION-$REVISION"
fi
echo "New version: $NEW_VERISION"
echo "::notice::Going from $VERSION to $NEW_VERSION"
tmp=$(mktemp)
jq --arg newversion "$NEW_VERSION" '.version = $newversion' $PACKAGE_FILE > $tmp
mv $tmp $PACKAGE_FILE
echo "::endgroup::"
- uses: pnpm/action-setup@v2
with:
version: 8.5.1
- name: Force update pnpm lockfile and/or DFL
if: ${{ inputs.force_pnpm != 'none' }}
run: |
if [[ "${{ env.pnpm_force }}" == "pnpm" ]]; then
$(which pnpm) -C . install --lockfile-only
elif [[ "${{ env.pnpm_force }}" == "dfl" ]]; then
$(which pnpm) -C . update --latest decky-frontend-lib
elif [[ "${{ env.pnpm_force }}" == "pnpm-dfl" ]]; then
$(which pnpm) -C . install --lockfile-only
$(which pnpm) -C . update --latest decky-frontend-lib
fi
- name: Download Decky CLI
run: |
mkdir /tmp/decky-cli
curl -L -o /tmp/decky-cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/download/0.0.2/decky-linux-x86_64"
chmod +x /tmp/decky-cli/decky
echo "/tmp/decky-cli" >> $GITHUB_PATH
- name: Build plugin
run: |
echo "::group::Building plugin $plugin"
# Run the CLI as root to get around Docker's weird permissions
sudo $(which decky) plugin build -b -o /tmp/output -s directory .
sudo chown -R $(whoami) .
echo "::endgroup::"
- name: Prep Artifacts
run: |
mkdir /tmp/artifacts -p
unzip /tmp/output/junkstore.zip -d /tmp/artifacts/
mv /tmp/artifacts/junkstore /tmp/artifacts/Junk-Store
- name: Upload Artifacts to Github
if: ${{ !env.ACT }}
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
with:
name: Junk-Store
path: /tmp/artifacts/**/*