diff --git a/.github/workflows/release-master.yaml b/.github/workflows/release-master.yaml index a3e4bf3..65a8998 100644 --- a/.github/workflows/release-master.yaml +++ b/.github/workflows/release-master.yaml @@ -6,10 +6,14 @@ on: branches: - master -permissions: write-all +permissions: + contents: write + pull-requests: write + issues: write + deployments: write concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: release-master-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/release-check.yaml b/.github/workflows/semantic-release-report.yaml similarity index 79% rename from .github/workflows/release-check.yaml rename to .github/workflows/semantic-release-report.yaml index 1e7dd12..7303bf2 100755 --- a/.github/workflows/release-check.yaml +++ b/.github/workflows/semantic-release-report.yaml @@ -1,17 +1,21 @@ --- -name: Semantic Release Check 📝 +name: Semantic Release Report 📝 on: pull_request: branches: + - beta - master -permissions: write-all +permissions: + contents: write + issues: write + pull-requests: write jobs: PR-checks: # https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow runs-on: ubuntu-latest - name: Semantic Release Check 📝 + name: Semantic Release Report 📝 steps: - name: 📀 Checkout uses: actions/checkout@v4 @@ -21,13 +25,19 @@ jobs: - name: 🖥️ Setup Env uses: ./.github/workflows/install - - name: 🔬 Check semantic versioning + - name: 🔬 Check Semantic Versioning id: semantic-release run: | GITHUB_REF=${{ github.head_ref }} npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator --branches ${{ github.head_ref }} > output.txt - OUTPUT=$(cat output.txt | base64 -w 0) - echo "::set-output name=releaseNote::$OUTPUT" + REPORT=$(cat output.txt | base64 -w 0) + + VERSION=$(cat output.txt | \ + grep "The next release version is" | \ + node -e "console.log(require('fs').readFileSync(0, 'utf-8').match(/The next release version is (\d+\.\d+\.\d+(-beta\.\d+)?)/)?.[1] ?? '')") + + echo "releaseNote=$REPORT" >> $GITHUB_OUTPUT + echo "version=$VERSION" >> $GITHUB_OUTPUT - name: 📝 Report semantic versioning uses: actions/github-script@v7 @@ -43,6 +53,8 @@ jobs: .reverse() .findIndex((line) => line.match(semanticReleaseLogMatch)); + const nextVersion = '${{ steps.semantic-release.outputs.version }}'; + const releaseNoteIndex = lines.length - lastSemanticReleaseLogIndex; const releaseNote = lines.slice(releaseNoteIndex); @@ -52,7 +64,8 @@ jobs: } const SEMANTIC_RELEASE_BODY_HEADER = '## 📝 Semantic Release Report'; - const body = [SEMANTIC_RELEASE_BODY_HEADER, res].join('\n'); + const NEXT_VERSION_HEADER = `### 🚀 Next Version: ${nextVersion}`; + const body = [SEMANTIC_RELEASE_BODY_HEADER, NEXT_VERSION_HEADER, res].join('\n'); // get last comment const comments = await github.rest.issues.listComments({