Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrate to new way to set environment variables in GHA #1139

Merged
merged 2 commits into from
Oct 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
run: |
if [ $IS_MAJOR == 'true' ]
then
echo "::set-env name=BV_PART::major"
echo "BV_PART=major" >> $GITHUB_ENV
elif [ $IS_MINOR == 'true' ]
then
echo "::set-env name=BV_PART::minor"
echo "BV_PART=minor" >> $GITHUB_ENV
else
echo "::set-env name=BV_PART::patch"
echo "BV_PART=patch" >> $GITHUB_ENV
fi
- name: Checkout repository
uses: actions/[email protected]
Expand Down Expand Up @@ -69,20 +69,20 @@ jobs:
- name: Run bump2version ${{ env['BV_PART'] }}
run: |
OLD_TAG=$(git describe --tags --abbrev=0)
echo "::set-env name=OLD_TAG::${OLD_TAG}"
echo "OLD_TAG=${OLD_TAG}" >> $GITHUB_ENV
bump2version $BV_PART --message "Bump version: {current_version} → {new_version}

Triggered by #${PR_NUMBER} via GitHub Actions."
NEW_TAG=$(git describe --tags --abbrev=0)
echo "::set-env name=NEW_TAG::${NEW_TAG}"
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
git tag -n99 -l $NEW_TAG

CHANGES=$(git log --pretty=format:'%s' $OLD_TAG..HEAD -i -E --grep='^([a-z]*?):')
CHANGES_NEWLINE="$(echo "${CHANGES}" | sed -e 's/^/ - /')"
SANITIZED_CHANGES=$(echo "${CHANGES}" | sed -e 's/^/<li>/' -e 's|$|</li>|' -e 's/(#[0-9]\+)//' -e 's/"/'"'"'/g')
echo "::set-env name=CHANGES::${SANITIZED_CHANGES//$'\n'/}"
echo "CHANGES=${SANITIZED_CHANGES//$'\n'/}" >> $GITHUB_ENV
NUM_CHANGES=$(echo -n "$CHANGES" | grep -c '^')
echo "::set-env name=NUM_CHANGES::${NUM_CHANGES}"
echo "NUM_CHANGES=${NUM_CHANGES}" >> $GITHUB_ENV
git tag $NEW_TAG $NEW_TAG^{} -f -m "$(printf "This is a $BV_PART release from $OLD_TAG → $NEW_TAG.\n\nChanges:\n$CHANGES_NEWLINE")"
git tag -n99 -l $NEW_TAG
- name: Comment on issue
Expand Down