Skip to content

Commit

Permalink
Merge pull request #58 from moia-oss/fixsemver
Browse files Browse the repository at this point in the history
Fix semver
  • Loading branch information
rinde authored Apr 2, 2024
2 parents 509f9a6 + e83595b commit ae61bfd
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,52 @@ jobs:
- name: Make lint
run: make lint
semver:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
# Manually extract labels because rymndhng/release-on-push-action can't do this correctly on a PR
- name: Extract labels
id: extract_version_bump
shell: bash
run: |
if [ ${{contains( github.event.pull_request.labels.*.name, 'release:major')}} = true ]; then
echo "bump_version=major" >> $GITHUB_OUTPUT
elif [ ${{contains( github.event.pull_request.labels.*.name, 'release:minor')}} = true ]; then
echo "bump_version=minor" >> $GITHUB_OUTPUT
elif [ ${{contains( github.event.pull_request.labels.*.name, 'norelease')}} = true ]; then
echo "bump_version=" >> $GITHUB_OUTPUT
else
echo "bump_version=patch" >> $GITHUB_OUTPUT
fi
- name: Calculate next version
id: calc_version
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: patch
bump_version_scheme: ${{ steps.extract_version_bump.outputs.bump_version }}
tag_prefix: ""
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print version
run: |
echo "${{steps.calc_version.outputs.version}} ${{github.event.pull_request.labels}}"
echo "${{ steps.extract_version_bump.outputs.bump_version }}"
echo "${{toJson(github.event.pull_request.labels.*.name)}}"
- name: Set version
if: ${{ steps.calc_version.outputs.version }} != ""
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
run: |
sed -i "s/^version = \".*\"$/version = \"${{ steps.calc_version.outputs.version }}\"/" Cargo.toml
- name: Commit new version to main but don't push
if: ${{ steps.calc_version.outputs.version }} != ""
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
run: |
git config --global user.email "[email protected]"
git config --global user.name "MOIA Rust Maintainers"
git commit -am "Phantom release ${{ steps.calc_version.outputs.version }} [skip ci]"
- name: Check semver
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
version-tag-prefix: ''

0 comments on commit ae61bfd

Please sign in to comment.