-
Notifications
You must be signed in to change notification settings - Fork 77
65 lines (55 loc) · 2.46 KB
/
archive.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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: Unzip
shell: bash
run: |
mkdir binaries
unzip '*.zip' -d binaries
- 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://${{ secrets.API_TOKEN_GITHUB }}@github.com/Villavu/Simba-Build-Archive
date_year=$(date +"%Y")
date_month_day=$(date +"%m-%d")
branch=${{ github.event.workflow_run.head_branch }}
commit=${{ github.event.workflow_run.head_sha }}
cd Simba-Build-Archive
mkdir -p "$date_year/$date_month_day $branch $commit"
mv ../binaries/* "$date_year/$date_month_day $branch $commit"
sed -i "6 i $date_year/$date_month_day | $branch | [$commit](https://github.com/Villavu/Simba/commit/$commit) | [Link](https://github.com/Villavu/Simba-Build-Archive/tree/main/$date_year/$date_month_day%20$branch%20$commit)" README.md
git add .
git commit --message "${{ github.event.workflow_run.head_sha }}"
git push https://${{ secrets.API_TOKEN_GITHUB }}@github.com/villavu/simba-build-archive