Skip to content

Bump tar from 6.1.11 to 6.2.1 (#128) #74

Bump tar from 6.1.11 to 6.2.1 (#128)

Bump tar from 6.1.11 to 6.2.1 (#128) #74

Workflow file for this run

# This workflow will create a new release every time a new version is encountered in package.json on the main branch
name: Release
on:
push:
branches:
- main
jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v2
with:
fetch-depth: 0
ssh-key: ${{ secrets.HFC_BOT_SSH_KEY }}
- name: git config
run: |
git config user.name hfc-bot
git config user.email [email protected]
- name: Check if tag already exists
run: |
# Get version from package.json (head is needed because this also returns "version" npm script line)
sed -n '/version/s/,*\r*$//p' package.json | cut -d ':' -f2,3 | sed -e 's/^ "//' -e 's/"$//' | head -n 1 > app_version.tmp
export VERSION_TAG="v$(cat app_version.tmp)"
echo "package_version=$(cat app_version.tmp)" >> $GITHUB_ENV
# Check if tag already exists
if [ $(git tag -l "$VERSION_TAG") ]; then
echo "Tag already exists, please increment version to create release"
echo "create_release=no" >> $GITHUB_ENV
else
echo "create_release=yes" >> $GITHUB_ENV
fi
- name: Generate Changelog
run: cat CHANGELOG.md | grep -Pzo "## ${{ env.package_version }}\s+((.|\n)+?)(?=\n##\s)" | head -n -1 > ${{ github.workflow }}-CHANGELOG.md
- name: Create Tag (from hfc-bot)
if: ${{ env.create_release == 'yes' }}
run: |
git tag -a v${{ env.package_version }} -m "v${{ env.package_version }}"
git push --follow-tags
- name: Release
uses: softprops/action-gh-release@master
if: ${{ env.create_release == 'yes' }}
with:
body_path: ${{ github.workflow }}-CHANGELOG.md
tag_name: v${{ env.package_version }}
target_commitish: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}