diff --git a/.github/workflows/approve-merge.yaml b/.github/workflows/approve-merge.yaml new file mode 100644 index 00000000..97ff24ad --- /dev/null +++ b/.github/workflows/approve-merge.yaml @@ -0,0 +1,25 @@ +name: Merge Release PR + +on: + pull_request_review: + types: [submitted] + +jobs: + pr_approved: + if: ${{ github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.ref == 'next' }} + runs-on: ubuntu-latest + steps: + - name: Clone git repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Merge PR + run: | + git checkout main + git merge --ff origin/next + git push -u origin main + + - uses: peter-evans/repository-dispatch@v3 + with: + event-type: release_main diff --git a/.github/workflows/base-build-job.yaml b/.github/workflows/base-build-job.yaml index 7b389242..2bf02198 100644 --- a/.github/workflows/base-build-job.yaml +++ b/.github/workflows/base-build-job.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v4 with: - node-version: '18.17' + node-version-file: '.nvmrc' - name: Upgrade npm run: npm i -g npm diff --git a/.github/workflows/base-test-job.yaml b/.github/workflows/base-test-job.yaml index c148fcdb..48ff4a9e 100644 --- a/.github/workflows/base-test-job.yaml +++ b/.github/workflows/base-test-job.yaml @@ -32,7 +32,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v4 with: - node-version: '18.17' + node-version-file: '.nvmrc' - name: Upgrade npm run: npm i -g npm diff --git a/.github/workflows/pr-lint.yaml b/.github/workflows/pr-lint.yaml new file mode 100644 index 00000000..1e6aa178 --- /dev/null +++ b/.github/workflows/pr-lint.yaml @@ -0,0 +1,20 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: pr-lint + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-pr.yaml b/.github/workflows/release-pr.yaml new file mode 100644 index 00000000..cfcfc847 --- /dev/null +++ b/.github/workflows/release-pr.yaml @@ -0,0 +1,41 @@ +name: Release PR + +on: + push: + branches: + - next + +permissions: + contents: read + +jobs: + release_pr: + permissions: + issues: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Install Dependencies + run: npm clean-install + + - name: Generate Changes + run: | + echo '# Release Changes' > changes.md + echo 'n' | npx lerna version --no-changelog --no-commit-hooks --no-git-tag-version --no-push 2> /dev/null | head -n -3 | tee -a changes.md + printf '\n---\n\n### Approve this PR to release above packages!' >> changes.md + + - name: Create PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + export PR_NUMBER=$(gh pr list -B main -H next --json number | jq -r '.[0].number') + if [[ "$PR_NUMBER" == "null" ]]; then gh pr create -B main -H next -t "chore: release" -F changes.md; fi + if [[ "$PR_NUMBER" != "null" ]]; then gh pr edit $PR_NUMBER -F changes.md; fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 59bbd662..d187c68c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v4 with: - node-version: '18.17' + node-version-file: '.nvmrc' - name: Upgrade npm run: npm i -g npm diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..aacb5181 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.17