Separate the bump version check and use a different event (#2284)
* Separate the bump version check and use a different event * Fix typo * Fix * Add more events * Typo
This commit is contained in:
parent
af8f360e0e
commit
93b3450671
2 changed files with 55 additions and 52 deletions
52
.github/workflows/pr-build-validation.yml
vendored
52
.github/workflows/pr-build-validation.yml
vendored
|
@ -3,60 +3,8 @@ name: PR Font Build Validation
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump_version_check:
|
|
||||||
name: Bump version check
|
|
||||||
if: github.repository == 'be5invis/Iosevka' && github.base_ref == 'dev'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
changed: ${{ steps.check_changes.outputs.changed }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout PR
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.ref }}
|
|
||||||
|
|
||||||
- name: Use Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: lts/*
|
|
||||||
|
|
||||||
- name: Bump version
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run bump-ver
|
|
||||||
|
|
||||||
- id: check_changes
|
|
||||||
name: Check changes
|
|
||||||
run: |
|
|
||||||
git config core.autocrlf false
|
|
||||||
if git diff --quiet; then
|
|
||||||
echo "changed=0" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "changed=1" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit to PR
|
|
||||||
if: steps.check_changes.outputs.changed == '1'
|
|
||||||
run: |
|
|
||||||
git config --local user.email "actions@github.com"
|
|
||||||
git config --local user.name "GitHub Actions"
|
|
||||||
git add --all
|
|
||||||
git commit -m "Bump version"
|
|
||||||
git push
|
|
||||||
|
|
||||||
- name: Add PR comment
|
|
||||||
uses: mshick/add-pr-comment@v2
|
|
||||||
if : steps.check_changes.outputs.changed == '1'
|
|
||||||
with:
|
|
||||||
message: |
|
|
||||||
Your pull request changes the version number.
|
|
||||||
A commit has been made to bump the version number.
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.fontName }} font
|
name: Build ${{ matrix.fontName }} font
|
||||||
needs: bump_version_check
|
|
||||||
if: github.repository == 'be5invis/Iosevka'
|
if: github.repository == 'be5invis/Iosevka'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|
55
.github/workflows/pr-bump-version.yml
vendored
Normal file
55
.github/workflows/pr-bump-version.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
name: PR Bump Version
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
branches: [dev]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump_version_check:
|
||||||
|
name: Bump version check
|
||||||
|
if: github.repository == 'be5invis/Iosevka' && github.base_ref == 'dev'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
changed: ${{ steps.check_changes.outputs.changed }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout PR
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run bump-ver
|
||||||
|
|
||||||
|
- id: check_changes
|
||||||
|
name: Check changes
|
||||||
|
run: |
|
||||||
|
git config core.autocrlf false
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "changed=0" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "changed=1" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit to PR
|
||||||
|
if: steps.check_changes.outputs.changed == '1'
|
||||||
|
run: |
|
||||||
|
git config --local user.email "actions@github.com"
|
||||||
|
git config --local user.name "GitHub Actions"
|
||||||
|
git add --all
|
||||||
|
git commit -m "Bump version"
|
||||||
|
git push
|
||||||
|
|
||||||
|
- name: Add PR comment
|
||||||
|
uses: mshick/add-pr-comment@v2
|
||||||
|
if : steps.check_changes.outputs.changed == '1'
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
Your pull request changes the version number.
|
||||||
|
A commit has been made to bump the version number.
|
Loading…
Add table
Add a link
Reference in a new issue