diff --git a/.github/workflows/pr-workflow.yml b/.github/workflows/pr-workflow.yml index 0371ed3..a8d2070 100644 --- a/.github/workflows/pr-workflow.yml +++ b/.github/workflows/pr-workflow.yml @@ -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: @@ -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..." @@ -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' @@ -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 diff --git a/package-lock.json b/package-lock.json index dcd66d8..0ac6a31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mochawesome-json-to-md", - "version": "1.3.4", + "version": "1.3.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mochawesome-json-to-md", - "version": "1.3.4", + "version": "1.3.5", "license": "MIT", "dependencies": { "commander": "^11.1.0", diff --git a/package.json b/package.json index 71669a6..a362b86 100644 --- a/package.json +++ b/package.json @@ -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": {