Skip to content

Commit d4fc3a9

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 80ca8c1 + a87f1a6 commit d4fc3a9

File tree

3 files changed

+58
-8
lines changed

3 files changed

+58
-8
lines changed

.github/workflows/build-binaries.yml

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ jobs:
133133
run: |
134134
if [[ ${GITHUB_REF##*/} = 2*.[0-9]*.[0-9]* ]]; then
135135
TAG="${GITHUB_REF##*/}"
136+
.github/workflows/release.sh "" "${{ secrets.GITHUB_TOKEN }}" $TAG
137+
.github/workflows/release.sh "debug" "${{ secrets.GITHUB_TOKEN }}" $TAG
136138
else
137139
TAG="$DEFAULT_TAG"
138140
fi

.github/workflows/pack-binaries.sh

-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ function make_change_log()
1717
done
1818
}
1919

20-
if [[ ${GITHUB_REF##*/} = 2*.[0-9]*.[0-9]* ]] ; then
21-
# For tags `actions/checkout@v2` action fetches a tag's commit, but
22-
# not the tag annotation itself. Let's refetch the tag from origin.
23-
# This makes `git show --no-patch --format=%n $TAG` work again.
24-
git tag --delete ${GITHUB_REF##*/}
25-
git fetch --tags
26-
fi
27-
2820
chmod -R -v +x als-*-$DEBUG
2921
for X in Linux macOS Windows ; do mv -v -f als-$X-$DEBUG/* integration/vscode/ada/; done
3022
pushd integration/vscode/ada

.github/workflows/release.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
set -x -e
3+
DEBUG=$1 # Value is '' or 'debug'
4+
GITHUB_ACCESS_TOKEN=$2
5+
TAG=$3 # Release name/tag
6+
7+
# For tags `actions/checkout@v2` action fetches a tag's commit, but
8+
# not the tag annotation itself. Let's refetch the tag from origin.
9+
# This makes `git show --no-patch --format=%n $TAG` work again.
10+
git tag --delete $TAG
11+
git fetch --tags
12+
13+
git show --no-patch --format=%n $TAG | \
14+
sed -e '1,/Release notes/d' > release_notes.md
15+
16+
# Try to create a release
17+
jq --null-input --arg tag $TAG \
18+
--rawfile body release_notes.md \
19+
'{"tag_name": $tag, "name": $tag, "body": $body}' | \
20+
curl -v \
21+
-X POST \
22+
-H "Accept: application/vnd.github+json" \
23+
-H "Authorization: token $GITHUB_ACCESS_TOKEN" \
24+
-H 'Content-Type: application/json' \
25+
https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
26+
-d "@-"
27+
28+
rm -f release_notes.md
29+
30+
# Get asset upload url, drop "quotes" around it and {parameters} at the end
31+
upload_url=$( curl \
32+
-H "Accept: application/vnd.github+json" \
33+
-H "Authorization: token $GITHUB_ACCESS_TOKEN" \
34+
https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | \
35+
jq -r '.upload_url | rtrimstr("{?name,label}")')
36+
37+
echo "upload_url=$upload_url"
38+
39+
chmod -R -v +x als-*-$DEBUG
40+
41+
for X in Linux macOS Windows ; do
42+
FILE=als-$TAG-$X${DEBUG:+-debug}_amd64.zip
43+
cd als-$X-$DEBUG
44+
zip -9 -r ../$FILE .
45+
cd ..
46+
47+
# Upload $FILE as an asset to the release
48+
curl \
49+
-X POST \
50+
-H "Accept: application/vnd.github+json" \
51+
-H "Authorization: token $GITHUB_ACCESS_TOKEN" \
52+
-H 'Content-Type: application/zip' \
53+
--data-binary @$FILE \
54+
$upload_url?name=$FILE
55+
rm -v -f $FILE
56+
done

0 commit comments

Comments
 (0)