forked from rzc0d3r/ESET-KeyGen
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.8 KB
/
shadow-copy.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
name: Create Shadow Release
on:
workflow_dispatch:
jobs:
duplicate:
runs-on: ubuntu-latest
steps:
- name: Main
run: |
owner="shadowcopyrz"
repo="ESET-KGEN-COPY"
response=$(curl https://api.github.com/repos/rzc0d3r/ESET-KeyGen/releases/latest)
assets_url=$(echo "$response" | jq -r ".assets_url")
src_code_archive_url=$(echo "$response" | jq -r ".zipball_url")
tag_name=$(echo "$response" | jq -r ".tag_name")
release_name=$(echo "$response" | jq -r ".name")
assets_json=$(curl "$assets_url")
# Downloading builds and source code
curl -H "Authorization: Bearer ${{ secrets.PAT }}" "$src_code_archive_url" -L -o src.zip
for url in $(echo "$assets_json" | jq -r '.[].browser_download_url'); do
curl -H "Authorization: Bearer ${{ secrets.PAT }}" "$url" -L -O
done
# Creating shadow release
response=$(curl -X POST "https://api.github.com/repos/$owner/$repo/releases" \
-H "Authorization: Bearer ${{ secrets.PRJ_COPY }}" \
-d '{
"tag_name": "'"$tag_name"'",
"name": "'"$release_name"'",
"body": "",
"draft": false,
"prerelease": false
}')
# Uploading assets to shadow release
release_id=$(echo "$response" | jq -r ".id")
for file in *; do
file=$(find $(pwd) -name "$file" -type f)
curl -X POST --data-binary @"$file" \
-H "Authorization: Bearer ${{ secrets.PRJ_COPY }}" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/$owner/$repo/releases/$release_id/assets?name=$(basename "$file")"
done