Skip to content

Release version 5.0.6 #6

Release version 5.0.6

Release version 5.0.6 #6

Workflow file for this run

name: Create Release
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Check commit message and extract version
id: extract_version
run: |
COMMIT_MESSAGE=$(git log --format=%B -n 1)
VERSION=$(echo $COMMIT_MESSAGE | grep -oP 'Release version \K(\d+\.\d+\.\d+)')
if [[ -z "$VERSION" ]]; then
echo "No version number found in commit message."
else
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "IS_VALID=true" >> $GITHUB_ENV
fi
- name: Update version in bt_ifcmanager.rb
if: env.is_valid == 'true'
run: |
sed -i "s/VERSION = '.*'/VERSION = '${{ steps.extract_version.outputs.version }}'/" src/bt_ifcmanager.rb
- name: Commit changes
if: env.is_valid == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update version to ${{ steps.extract_version.outputs.version }}" -a
- name: Push changes
if: env.is_valid == 'true'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create RBZ file
if: steps.check_version.outputs.is_valid == 'true'
run: |
zip -r bt_ifcmanager-${{ steps.extract_version.outputs.version }}.rbz src/
- name: Generate release notes
if: env.is_valid == 'true'
id: generate_notes
run: |
VERSION=${{ steps.extract_version.outputs.version }}
PREVIOUS_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
RELEASE_NOTES=$(git log --pretty=format:"- %s" $PREVIOUS_TAG..HEAD)
if [[ -z "$RELEASE_NOTES" ]]; then
RELEASE_NOTES="No changes since the last release."
fi
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_ENV
- name: Create Release
if: env.is_valid == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: Sketchup-IFC-Manager ${{ steps.extract_version.outputs.version }}
body: ${{ env.RELEASE_NOTES }}
draft: true
prerelease: false
- name: Upload Release Asset
if: env.is_valid == 'true'
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bt_ifcmanager-${{ steps.extract_version.outputs.version }}.rbz
asset_name: bt_ifcmanager-${{ steps.extract_version.outputs.version }}.rbz
asset_content_type: application/zip