Skip to content

Commit

Permalink
ci: check if version is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
mkfsn committed May 19, 2021
1 parent eac541e commit 60ca4d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/draft-new-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ jobs:
- name: Extract version from branch name
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
BRANCH_NAME="${{ echo ${GITHUB_REF#refs/heads/} }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Validate the version
id: regex-match
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ env.RELEASE_VERSION }}
regex: '^v\d+(\.\d+){2}$'

- name: Create pull request
if: ${{ steps.regex-match.outputs.match != '' }}
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-new-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ jobs:
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Validate the version
id: regex-match
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ env.RELEASE_VERSION }}
regex: '^v\d+(\.\d+){2}$'

- name: Create Release
if: ${{ steps.regex-match.outputs.match != '' }}
id: generate_changelog
uses: release-drafter/release-drafter@v5
env:
Expand Down

0 comments on commit 60ca4d2

Please sign in to comment.