Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GitHub Actions] Emscripten workflow tweaks - pt 2 #3635

Merged
merged 1 commit into from
Feb 15, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/CI_emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ jobs:
built-commit-sha: ${{ needs.web-build.outputs.WZ_GITHUB_SHA }}
release: false
ssh-dest-host: ${{ vars.WZ_WEB_BUILD_UPLOAD_SSH_HOST }}
cdn-purge-base-url: 'play.wz2100.net/dev'
secrets: inherit

publish_release_build:
Expand All @@ -224,4 +225,5 @@ jobs:
built-commit-sha: ${{ needs.web-build.outputs.WZ_GITHUB_SHA }}
release: true
ssh-dest-host: ${{ vars.WZ_WEB_BUILD_UPLOAD_SSH_HOST }}
cdn-purge-base-url: 'play.wz2100.net/release'
secrets: inherit
17 changes: 14 additions & 3 deletions .github/workflows/publish_web_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
description: 'The destination HOST for the rsync'
required: true
type: string
cdn-purge-base-url:
description: 'The base URL for CDN cache purging'
required: false
type: string
secrets:
WZ_WEB_BUILD_UPLOAD_SSH_KEY:
required: true
Expand All @@ -52,6 +56,7 @@ jobs:
WASM_ARCHITECTURE: ${{ inputs.architecture }}
WZ_GITHUB_REF: ${{ inputs.built-ref }}
WZ_IS_RELEASE: ${{ inputs.release }}
INPUT_CDN_PURGE_BASE_URL: ${{ inputs.cdn-purge-base-url }}
run: |
mkdir dl-archive
CHANGELOG_DIR="${GITHUB_WORKSPACE}/temp/changes"
Expand All @@ -67,7 +72,7 @@ jobs:
if [ "${WASM_ARCHITECTURE}" == "wasm32" ]; then
WZ_UPLOAD_SUBDIR=""
fi
# Determine upload path
# Determine upload path - always starts with a slash
if [ "${WZ_IS_RELEASE}" == "true" ]; then
SOURCE_TAG="${WZ_GITHUB_REF#refs/tags/}"
WZ_UPLOAD_PATH="/${SOURCE_TAG}/${WZ_UPLOAD_SUBDIR}"
Expand All @@ -76,6 +81,10 @@ jobs:
fi
echo "WZ_UPLOAD_PATH=${WZ_UPLOAD_PATH}" >> $GITHUB_ENV
echo "WZ_UPLOAD_PATH=${WZ_UPLOAD_PATH}" >> $GITHUB_OUTPUT
# Determine base CDN url path (remove any trailing slashes)
WZ_CDN_BASE_URL="$(echo "${INPUT_CDN_PURGE_BASE_URL}" | sed 's:/*$::')"
echo "WZ_CDN_BASE_URL=${WZ_CDN_BASE_URL}" >> $GITHUB_ENV
echo "WZ_CDN_BASE_URL=${WZ_CDN_BASE_URL}" >> $GITHUB_OUTPUT
- name: Download Archive Artifact
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -138,6 +147,7 @@ jobs:
rm ~/.ssh/id_ed25519
- name: 'Generate Cloudflare Cache Purge URLs List'
id: purgeurls
if: ${{ success() && env.WZ_CDN_BASE_URL != '' }}
env:
CHANGED_FILES_LIST: '${{ steps.fileslist.outputs.CHANGED_FILES_LIST }}'
CHANGED_SW_LIST: '${{ steps.fileslist.outputs.CHANGED_SW_LIST }}'
Expand All @@ -156,12 +166,13 @@ jobs:
exit 1
fi
# Run the gen_purge_url_batches script on the main list
python3 "./gen_purge_url_batches.py" "play.wz2100.net" "${CHANGED_FILES_LIST}" "${PURGE_URLS_DATA_FILES_DIR}"
python3 "./gen_purge_url_batches.py" "${WZ_CDN_BASE_URL}${WZ_UPLOAD_PATH}" "${CHANGED_FILES_LIST}" "${PURGE_URLS_DATA_FILES_DIR}"
echo "PURGE_URLS_DATA_FILES_DIR=${PURGE_URLS_DATA_FILES_DIR}" >> $GITHUB_OUTPUT
# Run the gen_purge_url_batches script on the service-worker file list
python3 "./gen_purge_url_batches.py" "play.wz2100.net" "${CHANGED_SW_LIST}" "${PURGE_SERVICEWORKER_URLS_DATA_FILES_DIR}"
python3 "./gen_purge_url_batches.py" "${WZ_CDN_BASE_URL}${WZ_UPLOAD_PATH}" "${CHANGED_SW_LIST}" "${PURGE_SERVICEWORKER_URLS_DATA_FILES_DIR}"
echo "PURGE_SERVICEWORKER_URLS_DATA_FILES_DIR=${PURGE_SERVICEWORKER_URLS_DATA_FILES_DIR}" >> $GITHUB_OUTPUT
- name: 'Purge Cloudflare Cache'
if: ${{ success() && env.WZ_CDN_BASE_URL != '' }}
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_WZ2100_ZONE }}
CLOUDFLARE_CACHEPURGE_TOKEN: ${{ secrets.CLOUDFLARE_WZ2100_CACHEPURGE_TOKEN }}
Expand Down
Loading