This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
updating run name #181
Workflow file for this run
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
name: Increment version | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, reopened] | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# If you have overriden the version in the version file, eg. to do a non-patch release and want to | |
# take this version as the base, not the latest tag, then uncomment this step and comment out the | |
# 'Get latest tag' step below. Then put them back! | |
# - name: "Set version in env" | |
# id: set-version | |
# run: | | |
# source version | |
# echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: "Get latest tag" | |
id: latest_tag | |
run: | | |
echo "VERSION="$(git for-each-ref --sort=-creatordate --count 1 --format="%(refname:short)" "refs/tags/*") >> $GITHUB_ENV | |
- name: Bump release version | |
id: bump_version | |
uses: christian-draeger/increment-semantic-version@1.1.0 | |
with: | |
current-version: ${{env.VERSION}} | |
version-fragment: "bug" | |
- name: Update version in version file | |
id: update_version | |
run: | | |
echo Updating version from $VERSION to ${{ steps.bump_version.outputs.next-version }} | |
echo Before updates | |
head version | |
sed -i 's/VERSION=${{env.VERSION}}/VERSION=${{ steps.bump_version.outputs.next-version }}/' version | |
echo After updates | |
head version | |
git config user.name 'FSD Github Actions' | |
git config user.email "fsd@levellingup.gov.uk" | |
git add version | |
git commit -m "Update version to ${{ steps.bump_version.outputs.next-version }}" | |
git push origin $GITHUB_HEAD_REF | |
echo "Updated version file with version ${{ steps.bump_version.outputs.next-version }}" >> $GITHUB_STEP_SUMMARY |