Adopt Richtea.RecommendedPractices #55
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: CI build | |
on: | |
pull_request: | |
branches: # Run the workflow for pull requests that target main branch | |
- main | |
workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
jobs: | |
init: | |
runs-on: ubuntu-latest | |
outputs: | |
build-version: ${{ steps.set_build_version.outputs.build-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get current version from changelog | |
id: get_current_version | |
uses: release-flow/keep-a-changelog-action@v2 | |
with: | |
command: query | |
version: latest-or-unreleased | |
- name: Parse current version number | |
uses: madhead/semver-utils@v4 | |
id: semver_parser | |
with: | |
# Parse the latest release version, or a default value if nothing is released | |
version: > | |
${{ steps.get_current_version.outputs.version != '[unreleased]' | |
&& steps.get_current_version.outputs.version | |
|| '0.0.0-ci.0' }} | |
- name: Set build version number | |
id: set_build_version | |
run: | | |
build_version='${{ steps.semver_parser.outputs.inc-prerelease }}' | |
if [[ -f $GITHUB_OUTPUT ]]; then | |
echo "build-version=$build_version" >> $GITHUB_OUTPUT | |
else | |
echo "::set-output name=build-version::$build_version" | |
fi | |
build: | |
needs: init | |
uses: ./.github/workflows/build-and-test.yml | |
with: | |
build-version: ${{ needs.init.outputs.build-version }} |