Skip to content

Commit 913f084

Browse files
Enhance deployment workflow with deploy ignore, concurrency support, and security fixes
- Add support for user-supplied .deployignore files and added built-in ignore rules - Exclude sensitive files by default (Steam credentials, .git/) - Add an option for concurrent staging paths with commit SHA to avoid conflicts with concurrent deployments (disabled by default) - Update manifest generation to use filtered staging directory - Add rsync installation in Dockerfile (used for .deployignore) - Added verbosity a control for rsync operations.
1 parent 0e7e616 commit 913f084

File tree

4 files changed

+140
-2
lines changed

4 files changed

+140
-2
lines changed

.deployignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# # # Use rsync EXCLUDE syntax # # #
2+
3+
#######
4+
# GIT #
5+
#######
6+
#The .git directory and everything under it
7+
.git/
8+
#Any .gitignore file
9+
.gitignore
10+
#Any .gitattributes file
11+
.gitattributes
12+
13+
##########
14+
# GITHUB #
15+
##########
16+
# Github specific applications and workflows
17+
.github/
18+
19+
################
20+
# STEAM DEPLOY #
21+
################
22+
#Any .deployignorefile
23+
.deployignore
24+
#The default deployment directory
25+
deploy/
26+
27+
#########
28+
# STEAM #
29+
#########
30+
# Steam login files and credentials
31+
config.vdf
32+
localconfig.vdf
33+
DialogConfig.vdf
34+
# Steam guard tokens
35+
ssfn*
36+
# app manifest files
37+
*.acf
38+
39+
###############
40+
# COMMON KEYS #
41+
###############
42+
.env
43+
.env.*
44+
.pem
45+
.key
46+
.crt

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
FROM steamcmd/steamcmd:ubuntu-22
22
COPY steam_deploy.sh /root/steam_deploy.sh
3+
COPY .deployignore /root/.defaultdeployignore
4+
RUN apt-get update && apt-get install -y rsync
35
ENTRYPOINT ["/root/steam_deploy.sh"]

action.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,27 @@ inputs:
3030
path:
3131
required: false
3232
default: ''
33-
description: 'The path of the directory to be uploaded, relative to the repository root.'
33+
description: 'The path of the directory containing the files you wish to upload, relative to the repository root.'
34+
deployIgnore:
35+
required: true
36+
default: ''
37+
description: 'The path of the deploy ignore file. Paths in this file are not included in the deployment. If a value is not supplied, will attempt to read a file named `.deployignore` from the root of the supplied path.'
38+
useBuiltinDeployIgnore:
39+
required: true
40+
default: 'true'
41+
description: 'Enables the built-in .deployignore rules to exclude common sensitive files during deployment. This is combined with the file supplied in `deployIgnore`'
42+
stagingPath:
43+
required: true
44+
default: '/tmp/steam_deploy/'
45+
description: 'The staging directory. Files will be copied from your `path` to here before being uploaded. Anything excluded under your .deployIgnore rules will not be copied here, and as such will not be packaged with your deployed artifact. This directory is not cleared when this workflow finishes.'
46+
concurrentStaging:
47+
required: true
48+
default: 'false'
49+
description: 'If `true`, the `stagingPath` will include the commit SHA as a subdirectory, ensuring each deployment uses its own isolated path and avoiding conflicts between concurrent deployments. Useful for self-hosted or nonephemeral actions runners. This directory is not cleared when this workflow finishes'
50+
verbosity:
51+
required: true
52+
default: "NORMAL"
53+
description: 'Sets the log verbosity. Can be either `NORMAL` or `TRACE`. If invalid, will behave as `TRACE`.'
3454
changeNote:
3555
required: false
3656
default: ''
@@ -50,3 +70,8 @@ runs:
5070
itemId: ${{ inputs.publishedFileId }}
5171
rootPath: ${{ inputs.path }}
5272
changeNote: ${{ inputs.changeNote }}
73+
deployIgnore: ${{ inputs.deployIgnore }}
74+
useBuiltinDeployIgnore: ${{ inputs.useBuiltinDeployIgnore }}
75+
stagingPath: ${{ inputs.stagingPath }}
76+
concurrentStaging: ${{ inputs.concurrentStaging }}
77+
verbosity: ${{ inputs.verbosity }}

steam_deploy.sh

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,71 @@ contentroot=$(pwd)/$rootPath
88

99
manifest_path=$(pwd)/manifest.vdf
1010

11+
echo ""
12+
echo "##########################"
13+
echo "# Calculating Deployment #"
14+
echo "##########################"
15+
echo ""
16+
17+
if [ "$concurrentStaging" == "true" ]; then
18+
stagingPath="$stagingPath/$GITHUB_SHA"
19+
fi
20+
21+
mkdir -p "$stagingPath"
22+
23+
echo "Staging Path: $stagingPath"
24+
25+
if [ -z "$deployIgnore" ]; then
26+
if [ -f "$contentroot/.deployignore" ]; then
27+
deployIgnore="$contentroot/.deployignore"
28+
echo "Using user content root .deployignore at $deployIgnore"
29+
else
30+
deployIgnore=""
31+
echo "no user .deployignore found"
32+
fi
33+
else
34+
# Make deployIgnore absolute if relative
35+
if [[ ! "$deployIgnore" = /* ]]; then
36+
deployIgnore="$contentroot/$deployIgnore"
37+
fi
38+
echo "Using user supplied deploy ignore file at $deployIgnore"
39+
fi
40+
41+
RSYNC_EXCLUDE_PARAMS=()
42+
43+
if [ "$useBuiltinDeployIgnore" == "true" ]; then
44+
echo "Including built-in deploy ignore"
45+
RSYNC_EXCLUDE_PARAMS+=(--exclude-from=/root/.defaultdeployignore)
46+
else
47+
echo "!!!!!!NOT USING BUILT IN DEPLOY IGNORE FILE!!!!!!"
48+
fi
49+
50+
if [ -n "$deployIgnore" ]; then
51+
echo "Including user deploy ignore file $deployIgnore"
52+
RSYNC_EXCLUDE_PARAMS+=(--exclude-from="$deployIgnore")
53+
fi
54+
55+
echo "# BuildIgnore Start #"
56+
57+
if [ "$useBuiltinDeployIgnore" = "true" ]; then
58+
cat /root/.defaultdeployignore || true
59+
fi
60+
echo ""
61+
if [ -n "$deployIgnore" ]; then
62+
cat "$deployIgnore" || true
63+
fi
64+
65+
echo "# BuildIgnore End #"
66+
67+
echo "Running rsync to package content..."
68+
69+
if [ "$verbosity" != "NORMAL" ]; then #NOTE: Documentation states that valid values are NORMAL and TRACE.
70+
rsync -av "${RSYNC_EXCLUDE_PARAMS[@]}" "$contentroot/" "$stagingPath"
71+
else #assume TRACE
72+
rsync -a "${RSYNC_EXCLUDE_PARAMS[@]}" "$contentroot/" "$stagingPath"
73+
fi
74+
75+
1176
echo ""
1277
echo "#################################"
1378
echo "# Generating Item Manifest #"
@@ -19,7 +84,7 @@ cat << EOF > "manifest.vdf"
1984
{
2085
"appid" "$appId"
2186
"publishedfileid" "$itemId"
22-
"contentfolder" "$contentroot"
87+
"contentfolder" "$stagingPath"
2388
"changenote" "$changeNote"
2489
}
2590
EOF

0 commit comments

Comments
 (0)