forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a GitHub Action to generate the changelog (babel#9434) [skip ci]
* Use a GitHub Action to generate the changelog * Update main.workflow [skip ci]
- Loading branch information
1 parent
344d35b
commit 44d8a59
Showing
7 changed files
with
1,527 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:10 | ||
|
||
LABEL "name" = "trigger-github-release" | ||
LABEL "version" = "0.0.1" | ||
|
||
LABEL "com.github.actions.name" = "Trigger GitHub release" | ||
LABEL "com.github.actions.description" = "Trigger a new GitHub release and generate the changelog using lerna-changelog." | ||
LABEL "com.github.actions.icon" = "tag" | ||
LABEL "com.github.actions.color" = "yellow" | ||
|
||
ADD entrypoint.sh /action/entrypoint.sh | ||
ADD package.json /action/package.json | ||
ADD package-lock.json /action/package-lock.json | ||
ADD release.js /action/release.js | ||
|
||
RUN chmod +x /action/entrypoint.sh | ||
|
||
ENTRYPOINT ["/action/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
echo "INFO: Installing action dependencies..." | ||
(cd /action; npm ci) | ||
|
||
echo "INFO: Checking out current tag..." | ||
git -c advice.detachedHead=false checkout $GITHUB_REF | ||
|
||
echo "INFO: Getting tag info..." | ||
current_tag=$(git describe --abbrev=0 --tags) | ||
last_tag=$(git describe --abbrev=0 --tags HEAD^) | ||
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: Done! Don't forget to thank new contributors :)" |
Oops, something went wrong.