Skip to content

Commit 1203e03

Browse files
Merge pull request #120 from ManuelHentschel/actions
Improve release action
2 parents e7a4a54 + 25fbd4a commit 1203e03

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
push:
88
tags: ["v*"]
99

10+
env:
11+
SCRIPT_FILE: "scripts/loadRPackage.sh"
12+
1013
jobs:
1114
build:
1215
runs-on: ubuntu-latest
@@ -29,20 +32,21 @@ jobs:
2932
timeout-minutes: 30
3033
needs: build
3134
runs-on: ubuntu-latest
32-
3335
steps:
36+
- uses: actions/checkout@v2
37+
- name: Download vscDebugger assets
38+
run: chmod +x $SCRIPT_FILE; $SCRIPT_FILE
3439
- name: Download artifacts
3540
uses: actions/download-artifact@v2
3641
with:
3742
path: "artifacts/"
38-
- name: Get version from tag
39-
id: get_version
40-
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\/v/}
4143
- name: Create release
4244
uses: marvinpinto/action-automatic-releases@latest
4345
with:
4446
repo_token: ${{ secrets.GITHUB_TOKEN }}
45-
files: "artifacts/*/*"
47+
files: |
48+
artifacts/*/*
49+
assets/*
4650
prerelease: false
47-
draft: true # add R binaries and change description before release
51+
draft: false
4852

scripts/loadRPackage.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
3+
# Read recommended R package version from package.json
4+
VERSION=$(cat package.json | jq -r .rPackageInfo.recommended)
5+
6+
URL=https://api.github.com/repos/ManuelHentschel/vscDebugger/releases/tags/v$VERSION
7+
8+
echo $URL
9+
10+
# Read info about release assets from GitHub API
11+
ASSETS=$(curl $URL | jq -r .assets)
12+
13+
# Abort, if no release/assets available
14+
if [ "$ASSETS" == "null" ]; then
15+
echo "No vscDebugger release with version $VERSION found!"
16+
exit 1
17+
fi
18+
19+
# Loop over assets and download them if they are vscDebugger binaries
20+
i=0
21+
NAME=$(echo $ASSETS | jq -r .[$i].name)
22+
23+
while [ "$NAME" != "null" ]
24+
do
25+
echo "$NAME"
26+
if [[ "$NAME" =~ "vscDebugger" ]]; then
27+
URL=$(echo $ASSETS | jq -r .[$i].browser_download_url)
28+
echo "$URL"
29+
wget -P assets "$URL"
30+
fi
31+
32+
i=$(( $i + 1 ))
33+
NAME=$(echo $ASSETS | jq -r .[$i].name)
34+
done
35+

0 commit comments

Comments
 (0)