Skip to content

archive

archive #1022

Workflow file for this run

name: archive
on:
workflow_run:
workflows:
- build
types:
- completed
jobs:
deploy:
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == 'Villavu/Simba' && !startsWith(github.event.workflow_run.head_branch, 'dev/')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
for (artifact of allArtifacts.data.artifacts) {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(artifact.name + '.zip', Buffer.from(download.data));
console.log('Downloaded: ' + artifact.name);
}
- name: Push
shell: bash
run: |
git config --global http.postBuffer 500M
git config --global user.email "villavu-bot"
git config --global user.name "villavu-bot"
git clone https://github.com/Villavu/Simba-Build-Archive
echo "Current repo (uncompressed) size:"
du -sh "Simba-Build-Archive" | awk '{print $1}'
date_year=$(date +"%Y")
date_month_day=$(date +"%m-%d")
branch=${{ github.event.workflow_run.head_branch }}
sha=${{ github.event.workflow_run.head_sha }}
commit=${sha::10}
echo "$date_year/$date_month_day | $branch | [$commit](https://github.com/Villavu/Simba/commit/$commit) | [Win32](/$date_year/$date_month_day%20$branch%20$commit/Win32.zip?raw=true) - [Win64](/$date_year/$date_month_day%20$branch%20$commit/Win64.zip?raw=true) - [Win64&nbsp;Debug](/$date_year/$date_month_day%20$branch%20$commit/Win64%20DebugInfo.zip?raw=true)<br>[Mac](/$date_year/$date_month_day%20$branch%20$commit/Mac.zip?raw=true) - [Mac Arm](/$date_year/$date_month_day%20$branch%20$commit/Mac%20Arm.zip?raw=true)<br>[Linux64](/$date_year/$date_month_day%20$branch%20$commit/Linux64.zip?raw=true)" > row.txt
cd Simba-Build-Archive
mkdir -p "$date_year/$date_month_day $branch $commit"
mv ../*.zip "$date_year/$date_month_day $branch $commit"
echo "Inserting row:"
cat ../row.txt
sed -i "6r ../row.txt" README.md
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Win32.zip?raw=true" > latest.win32
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Win64.zip?raw=true" > latest.win64
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Win64%20DebugInfo.zip?raw=true" > latest.win64debuginfo
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Linux64.zip?raw=true" > latest.linux64
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Mac.zip?raw=true" > latest.mac
echo "https://github.com/Villavu/Simba-Build-Archive/blob/main/$date_year/$date_month_day%20$branch%20$commit/Mac%20Arm.zip?raw=true" > latest.macarm
git add .
git commit --message "$commit"
git push https://${{ secrets.API_TOKEN_GITHUB }}@github.com/villavu/simba-build-archive