Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Deploy

# Manual only. Run it from the Actions tab when you want the site published: "web" uploads the
# site, "full" also applies infrastructure changes.
# Pushes to main deploy automatically: "full" when the infrastructure, deploy script, dependencies
# or workflows changed, otherwise "web" (just upload the site). Run it by hand from the Actions tab
# to pick either one.
on:
push:
branches: [main]
paths-ignore: ['**.md']
workflow_dispatch:
inputs:
target:
Expand All @@ -27,8 +31,28 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # to diff against the previous push
persist-credentials: false

- name: Pick full or web deploy
id: target
env:
EVENT: ${{ github.event_name }}
INPUT: ${{ inputs.target }}
BEFORE: ${{ github.event.before }}
run: |
if [ "$EVENT" = workflow_dispatch ]; then
target="$INPUT"
elif [ -z "$BEFORE" ] || ! git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
target=full # first push, or history we can't diff
elif git diff --name-only "$BEFORE" "$GITHUB_SHA" | grep -qE '^infra/|^scripts/deploy.mjs$|^cdk.json$|^package.json$|^yarn.lock$|^.github/'; then
target=full
else
target=web
fi
echo "target=$target" >> "$GITHUB_OUTPUT"
echo "### Deploying: $target" >> "$GITHUB_STEP_SUMMARY"

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
Expand Down Expand Up @@ -58,4 +82,4 @@ jobs:

- run: node scripts/deploy.mjs "$TARGET"
env:
TARGET: ${{ inputs.target }}
TARGET: ${{ steps.target.outputs.target }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ Both outputs are committed, so a deploy does not need the mods or the game.

## Deploy

Deployed to AWS with CDK. Publish by running the Deploy workflow from the Actions tab.
Deployed to AWS with CDK. Pushes to `main` publish automatically, and the Deploy workflow can also be run from the Actions tab.
Loading