Skip to content

CL-1.82.5-pre

CL-1.82.5-pre #311

Workflow file for this run

name: Upload to R2
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
Fetch:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
git clone --depth 1 https://github.com/CollapseLauncher/CollapseLauncher-ReleaseRepo.git cl-cdn
- name: Clean unused objects
run: |
rm -rf ./cl-cdn/.git
rm -rf ./cl-cdn/.github
rm -rf ./cl-cdn/actions
rm -rf ./cl-cdn/.gitignore
rm -rf ./cl-cdn/LICENSE
rm -rf ./cl-cdn/pack.bat
- name: Move folders around
run: |
echo Root folder
mkdir -p ./cl-cdn/folderroot
mv ./cl-cdn/ApplyUpdate.exe ./cl-cdn/changelog_preview.md ./cl-cdn/changelog_stable.md ./cl-cdn/CollapseLauncher.Hi3CacheUpdater.cmd ./cl-cdn/folderroot/
mv ./cl-cdn/notification_notepreview ./cl-cdn/notification_notestable ./cl-cdn/notification_preview.json ./cl-cdn/notification_stable.json ./cl-cdn/Update.exe ./cl-cdn/folderroot/
echo Metadata
mkdir -p ./cl-cdn/metadata/metadata-root
mkdir -p ./cl-cdn/metadata/metadata-root/v3
mv ./cl-cdn/metadata/v3/* ./cl-cdn/metadata/metadata-root/v3/
mv ./cl-cdn/metadata/metadatav2_previewconfig.json ./cl-cdn/metadata/metadatav2_previewstamp.json ./cl-cdn/metadata/metadata-root/
mv ./cl-cdn/metadata/metadatav2_stableconfig.json ./cl-cdn/metadata/metadatav2_stablestamp.json ./cl-cdn/metadata/metadata-root/
echo Images
mkdir -p ./cl-cdn/metadata/metadata-images/game_logos
mkdir -p ./cl-cdn/metadata/metadata-images/game_posters
mkdir -p ./cl-cdn/metadata/metadata-images/steam_assets
mv ./cl-cdn/metadata/game_logos/* ./cl-cdn/metadata/metadata-images/game_logos/
mv ./cl-cdn/metadata/game_posters/* ./cl-cdn/metadata/metadata-images/game_posters/
mv ./cl-cdn/metadata/steam_assets/* ./cl-cdn/metadata/metadata-images/steam_assets/
echo ApplyUpdate
mkdir -p ./cl-cdn/applyupdate/stable
mkdir -p ./cl-cdn/applyupdate/preview
mv ./cl-cdn/preview ./cl-cdn/applyupdate/
mv ./cl-cdn/stable ./cl-cdn/applyupdate/
- name: Archive objects
run: |
zip -0 -r root-cdn.zip ./cl-cdn/folderroot
zip -0 -r root-metadata.zip ./cl-cdn/metadata/metadata-root
zip -0 -r gameimages.zip ./cl-cdn/metadata/metadata-images
zip -0 -r indexes_hi3.zip ./cl-cdn/metadata/repair_indexes/Hi3CN ./cl-cdn/metadata/repair_indexes/Hi3Global ./cl-cdn/metadata/repair_indexes/Hi3JP ./cl-cdn/metadata/repair_indexes/Hi3KR ./cl-cdn/metadata/repair_indexes/Hi3SEA ./cl-cdn/metadata/repair_indexes/Hi3TW
zip -0 -r indexes_hsr.zip ./cl-cdn/metadata/repair_indexes/SRCN ./cl-cdn/metadata/repair_indexes/HSRCNBilibili ./cl-cdn/metadata/repair_indexes/SRGlb
zip -0 -r indexes_zzz.zip ./cl-cdn/metadata/repair_indexes/ZZZBilibili ./cl-cdn/metadata/repair_indexes/ZZZCN ./cl-cdn/metadata/repair_indexes/ZZZGlb
zip -0 -r applyupdate.zip ./cl-cdn/applyupdate
zip -0 -r squirrel-stable.zip ./cl-cdn/squirrel/stable
zip -0 -r squirrel-preview.zip ./cl-cdn/squirrel/preview
zip -0 -r velopack-preview.zip ./cl-cdn/velopack/preview
- name: Upload root-cdn
uses: actions/[email protected]
with:
name: root-cdn
path: root-cdn.zip
retention-days: 1
compression-level: 0
- name: Upload root-metadata
uses: actions/[email protected]
with:
name: root-metadata
path: root-metadata.zip
retention-days: 1
compression-level: 0
- name: Upload root-metadata
uses: actions/[email protected]
with:
name: gameimages
path: gameimages.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_hi3
uses: actions/[email protected]
with:
name: indexes_hi3
path: indexes_hi3.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_hsr
uses: actions/[email protected]
with:
name: indexes_hsr
path: indexes_hsr.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_zzz
uses: actions/[email protected]
with:
name: indexes_zzz
path: indexes_zzz.zip
retention-days: 1
compression-level: 0
- name: Upload applyupdate
uses: actions/[email protected]
with:
name: applyupdate
path: applyupdate.zip
retention-days: 1
compression-level: 0
- name: Upload squirrel-stable
uses: actions/[email protected]
with:
name: squirrel-stable
path: squirrel-stable.zip
retention-days: 1
compression-level: 0
- name: Upload squirrel-preview
uses: actions/[email protected]
with:
name: squirrel-preview
path: squirrel-preview.zip
retention-days: 1
compression-level: 0
- name: Upload velopack-preview
uses: actions/[email protected]
with:
name: velopack-preview
path: velopack-preview.zip
retention-days: 1
compression-level: 0
Sync-Root:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: root-cdn
- name: Extract Archive
run: unzip -qq root-cdn.zip -d root-cdn
- name: Sync Root Folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-cdn/cl-cdn/folderroot
destination-dir: cl-cdn
output-file-url: false
Sync-Metadata:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: root-metadata
- name: Extract Archive
run: |
unzip -qq root-metadata.zip -d root-metadata
- name: Sync Metadata root objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-root
destination-dir: cl-cdn/metadata
output-file-url: false
Sync-Images:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact (gameimages)
uses: actions/[email protected]
with:
name: gameimages
- name: Extract Archive
run: |
unzip -qq gameimages.zip -d root-metadata
- name: Sync Metadata logos objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/game_logos
destination-dir: cl-cdn/metadata/game_logos
output-file-url: false
- name: Sync Metadata posters objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/game_posters
destination-dir: cl-cdn/metadata/game_posters
output-file-url: false
- name: Sync Metadata steam-asset objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/steam_assets
destination-dir: cl-cdn/metadata/steam_assets
output-file-url: false
Sync-Indexes-Hi3:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_hi3
- name: Extract Archive
run: |
unzip -qq indexes_hi3.zip -d indexes_hi3
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_hi3/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-Indexes-HSR:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_hsr
- name: Extract Archive
run: |
unzip -qq indexes_hsr.zip -d indexes_hsr
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_hsr/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-Indexes-ZZZ:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_zzz
- name: Extract Archive
run: |
unzip -qq indexes_zzz.zip -d indexes_zzz
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_zzz/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-ApplyUpdate:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: applyupdate
- name: Extract Archive
run: unzip -qq applyupdate.zip -d applyupdate
- name: Sync ApplyUpdate-Preview
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: applyupdate/cl-cdn/applyupdate/preview
destination-dir: cl-cdn/preview
output-file-url: false
- name: Sync ApplyUpdate-stable
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: applyupdate/cl-cdn/applyupdate/stable
destination-dir: cl-cdn/stable
output-file-url: false
Sync-Squirrel-Stable:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: squirrel-stable
- name: Extract Archive
run: unzip -qq squirrel-stable.zip -d squirrel-stable
- name: Sync Squirrel\Stable folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: squirrel-stable/cl-cdn/squirrel/stable
destination-dir: cl-cdn/squirrel/stable
output-file-url: false
Sync-Squirrel-Preview:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: squirrel-preview
- name: Extract Archive
run: unzip -qq squirrel-preview.zip -d squirrel-preview
- name: Sync Squirrel\Preview folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: squirrel-preview/cl-cdn/squirrel/preview
destination-dir: cl-cdn/squirrel/preview
output-file-url: false
Sync-Velopack-Preview:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: velopack-preview
- name: Extract Archive
run: unzip -qq velopack-preview.zip -d velopack-preview
- name: Sync Squirrel\Preview folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: velopack-preview/cl-cdn/velopack/preview
destination-dir: cl-cdn/velopack/preview
output-file-url: false
Purge-Cache:
runs-on: ubuntu-latest
if: always() # always purge cache whenever it fails or succeed
needs: [Sync-Root, Sync-Metadata, Sync-Images, Sync-ApplyUpdate, Sync-Squirrel-Stable, Sync-Squirrel-Preview, Sync-Indexes-Hi3, Sync-Indexes-HSR, Sync-Indexes-ZZZ, Sync-Velopack-Preview]
steps:
- name: Purge Cloudflare cache
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_PURGE_CACHE_ZONEID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CF_PURGE_CACHE_TOKEN }}" \
-H "Content-Type: application/json" \
--data "{ \"purge_everything\": true }"