Skip to content

Commit

Permalink
merge(#48): fix: add tag to commit and get proper value for version
Browse files Browse the repository at this point in the history
fix: add tag to commit and get proper value for version
  • Loading branch information
403-html authored Feb 16, 2024
2 parents addb464 + 0802ffe commit c0aed58
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/pr-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
jobs:
semver-check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
Expand Down Expand Up @@ -52,6 +53,7 @@ jobs:
echo "Branch prefix is valid"
- name: Set next version number based on prefix
id: get-version
if: github.event_name == 'pull_request'
run: |
echo "Getting next version number..."
Expand All @@ -68,11 +70,11 @@ jobs:
echo "Error: working branch prefix not found"
exit 1
fi
echo "::set-output name=version::$(jq -r '.version' package.json)"
- name: Get version number
if: github.event_name == 'push'
id: get-version
run: echo "::set-output name=version::$(git describe --tags --abbrev=0)"
- name: Tag commit with new version
if: github.event_name == 'pull_request'
run: git tag ${{ steps.get-version.outputs.version }}

- name: Setup git
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -107,17 +109,19 @@ jobs:
gh-release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- semver-check
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get semver version
id: version-check
run: echo "::set-output name=version::$(jq -r '.version' package.json)"

- name: Create release
uses: softprops/action-gh-release@v1
with:
name: "New release ${{ needs.semver-check.outputs.version }}"
tag_name: ${{ needs.semver-check.outputs.version }}
name: "New release ${{ steps.version-check.outputs.version }}"
tag_name: ${{ steps.version-check.outputs.version }}
generate_release_notes: true
draft: false
prerelease: false
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mochawesome-json-to-md",
"version": "1.3.4",
"version": "1.3.5",
"description": "A repository containing a script to convert JSON reports generated by MochAwesome to Mardown",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit c0aed58

Please sign in to comment.