Skip to content

Commit

Permalink
ci: improve release report
Browse files Browse the repository at this point in the history
  • Loading branch information
Avivbens committed Apr 18, 2024
1 parent 4454ef2 commit a8a2035
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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({
Expand Down

0 comments on commit a8a2035

Please sign in to comment.