diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73ab2bf..5b30a5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,15 +4,21 @@ on: push: branches: - main + pull_request: + branches: + - main concurrency: ${{ github.workflow }}-${{ github.ref }} +permissions: + pull-requests: write + contents: write + jobs: release-stable: runs-on: ubuntu-latest name: Release Stable - outputs: - published: ${{ steps.changesets.outputs.published }} + if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -43,7 +49,7 @@ jobs: run: echo "CURRENT_PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV - name: Create Github Release - if: steps.changesets.outputs.published == 'true' + if: "startsWith(github.event.head_commit.message, 'chore(release): new version')" uses: softprops/action-gh-release@v2 with: tag_name: v${{ env.CURRENT_PACKAGE_VERSION }} @@ -52,7 +58,8 @@ jobs: runs-on: ubuntu-latest name: Release Unstable needs: release-stable - if: always() && github.event_name == 'push' && needs.release-stable.outputs.published == 'false' + if: "always() && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'ayanworks/credo-ethr-module') || (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release): new version'))" + steps: - name: Checkout Repo uses: actions/checkout@v4