-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathrelease_info.sh
More file actions
executable file
·28 lines (23 loc) · 1007 Bytes
/
release_info.sh
File metadata and controls
executable file
·28 lines (23 loc) · 1007 Bytes
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
#!/bin/bash
set -e
# Get latest version tag
get_last_tag() {
curl --silent "https://api.github.com/repos/fishjojo/pyscfad/releases/latest" | sed -n 's/.*"tag_name": "v\(.*\)",.*/\1/p'
}
last_version=$(get_last_tag)
echo Last version: $last_version
# Get current version tag
cur_version=$(sed -n "/^__version__ =/s/.*\"\(.*\)\"/\1/p" pyscfad/version.py)
if [ -z "$cur_version" ]; then
cur_version=$(sed -n "/^__version__ =/s/.*'\(.*\)'/\1/p" pyscfad/version.py)
fi
echo Current version: $cur_version
# Create version tag
if [ -n "$last_version" ] && [ -n "$cur_version" ] && [ "$cur_version" != "$last_version" ]; then
git config user.name "Github Actions"
git config user.email "github-actions@users.noreply.github.com"
version_tag=v"$cur_version"
# Extract release info from CHANGELOG
sed -n "/^## pyscfad $cur_version/,/^## pyscfad $last_version/p" CHANGELOG.md | tail -n +2 | sed -e '/^## pyscfad /,$d' | head -n -1 > RELEASE.md
echo "::set-output name=version_tag::$version_tag"
fi