-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path.cnb.yml
More file actions
61 lines (53 loc) · 1.77 KB
/
Copy path.cnb.yml
File metadata and controls
61 lines (53 loc) · 1.77 KB
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
.mirror_release_pipeline: &mirror_release_pipeline
git:
enable: false
docker:
image: ubuntu:22.04
stages:
- name: download release assets from github
script: |
set -eu
apt-get update
apt-get install -y curl jq
REPO="ChanIok/SpinningMomo"
TAG="${RELEASE_TAG:-}"
if [ -z "${TAG}" ]; then
echo "RELEASE_TAG is required, e.g. v1.2.3"
exit 1
fi
API_URL="https://api.github.com/repos/${REPO}/releases/tags/${TAG}"
if [ -n "${GITHUB_TOKEN:-}" ]; then
curl -fsSL -H "Authorization: Bearer ${GITHUB_TOKEN}" "${API_URL}" -o release.json
else
curl -fsSL "${API_URL}" -o release.json
fi
mkdir -p out
for keyword in "Setup.exe" "Portable.zip" "SHA256SUMS.txt"; do
url="$(jq -r --arg keyword "${keyword}" '.assets[] | select(.name | contains($keyword)) | .browser_download_url' release.json | head -n1)"
if [ -z "${url}" ] || [ "${url}" = "null" ]; then
echo "Missing release asset that contains keyword: ${keyword}"
exit 1
fi
file_name="$(basename "${url}")"
curl -fL --retry 3 --retry-delay 2 "${url}" -o "out/${file_name}"
done
ls -al out
- name: ensure cnb release exists
type: git:release
options:
tag: ${RELEASE_TAG}
title: ${RELEASE_TAG}
overlying: true
- name: upload mirrored files
image: cnbcool/attachments:latest
settings:
tag: ${RELEASE_TAG}
attachments:
- out/*
main:
api_trigger_release:
- <<: *mirror_release_pipeline
name: mirror-github-release-from-github-ci
web_trigger:
- <<: *mirror_release_pipeline
name: mirror-github-release-manual