-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
entrypoint.sh
executable file
路38 lines (27 loc) 路 1.23 KB
/
entrypoint.sh
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
#!/bin/sh
set -e
echo "INFO: Installing action dependencies..."
(cd /action; npm ci)
echo "INFO: Getting release version..."
current_tag=$(git describe --abbrev=0 --tags $GITHUB_SHA)
last_tag=$(git describe --abbrev=0 --tags $current_tag^)
echo "INFO: New version is $current_tag; last version is $last_tag."
echo "INFO: Generating the changelog..."
# lerna-changelog expects the token to be provided as GITHUB_AUTH,
# but GitHub actions don't allow to predefine custom env vars prefixed with
# GITHUB_. We need to define it here.
changelog=$(
GITHUB_AUTH="$GITHUB_TOKEN" \
node /action/node_modules/.bin/lerna-changelog --tag-from $last_tag --tag-to $current_tag
)
echo "INFO: Publishing the new GitHub release..."
echo "$changelog" | node /action/release $current_tag
echo "INFO: Updating CHANGELOG.md..."
echo "$changelog" | node /action/update-changelog
echo "INFO: Committing changelog..."
git add CHANGELOG.md
git -c user.name="$COMMIT_AUTHOR_NAME" -c user.email="$COMMIT_AUTHOR_EMAIL" \
commit -m "Add $current_tag to CHANGELOG.md [skip ci]" --no-verify --quiet
echo "INFO: Pushing updates..."
git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master
echo "INFO: Done! Don't forget to thank new contributors :)"