From 53fb39179407375f5356531b0eb4898413650bfc Mon Sep 17 00:00:00 2001 From: Victor Korzunin <5180700+floydspace@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:37:37 +0200 Subject: [PATCH] chore: update pnpm action-setup to v3 in release workflow --- .gitattributes | 1 + .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/pr.yml | 45 ----------------------------- .github/workflows/release.yml | 22 ++++++++------- .gitignore | 1 + .npmignore | 1 + .projen/files.json | 1 + package.json | 2 +- pnpm-lock.yaml | 8 +++--- projenrc/monorepo-project.ts | 8 ++++++ 10 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/pr.yml diff --git a/.gitattributes b/.gitattributes index 468eb180..c794b19c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ /.eslintrc.json linguist-generated /.gitattributes linguist-generated /.github/FUNDING.yml linguist-generated +/.github/workflows/build.yml linguist-generated /.github/workflows/release.yml linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..6565c8a6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +# ~~ Generated by projen. To modify, edit .projenrc.ts and run "pnpm exec projen". + +name: build +on: + pull_request: {} + workflow_dispatch: {} +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + self_mutation_happened: ${{ steps.self_mutation.outputs.self_mutation_happened }} + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: "8" + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: build + run: pnpm exec projen build + - name: Find mutations + id: self_mutation + run: |- + git add . + git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT + working-directory: ./ + - name: Upload patch + if: steps.self_mutation.outputs.self_mutation_happened + uses: actions/upload-artifact@v4 + with: + name: .repo.patch + path: .repo.patch + overwrite: true + - name: Fail build on mutation + if: steps.self_mutation.outputs.self_mutation_happened + run: |- + echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." + cat .repo.patch + exit 1 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 362af05f..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: PR Flow - -on: - pull_request: - branches: - - "main" - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.17.0] - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 - name: Install pnpm - id: pnpm-install - with: - version: 8 - run_install: false - - name: Get pnpm store directory - id: pnpm-cache - run: | - echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - run: pnpm install - - run: pnpm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04d7c92c..2cf8ed45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,6 @@ on: branches: - main workflow_dispatch: {} -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} jobs: release: runs-on: ubuntu-latest @@ -19,11 +17,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 - run_install: false + version: "8" - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -31,14 +32,15 @@ jobs: cache: pnpm - name: Install dependencies run: pnpm i --frozen-lockfile - - name: Build - run: pnpm build + - name: build + run: pnpm exec projen build - name: Create Release Pull Request or Publish uses: changesets/action@v1 - with: - version: pnpm bump - publish: pnpm release - commit: "chore(release): version packages" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + with: + version: npx projen bump + publish: npx projen release + commit: "chore(release): version packages" + setupGitUser: false diff --git a/.gitignore b/.gitignore index b36e9575..782bab3f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ jspm_packages/ .yarn-integrity .cache .tmp +!/.github/workflows/build.yml !/.prettierignore !/.prettierrc.json !/.npmrc diff --git a/.npmignore b/.npmignore index 57186b61..c6c5f273 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ # ~~ Generated by projen. To modify, edit .projenrc.ts and run "pnpm exec projen". /.projen/ +permissions-backup.acl /.prettierignore /.prettierrc.json /test/ diff --git a/.projen/files.json b/.projen/files.json index da694b37..570a88e3 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -4,6 +4,7 @@ ".eslintrc.json", ".gitattributes", ".github/FUNDING.yml", + ".github/workflows/build.yml", ".github/workflows/release.yml", ".gitignore", ".npmignore", diff --git a/package.json b/package.json index 6d7ba293..3194f2d7 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", "@effect/docgen": "^0.4.3", - "@floydspace/projen-components": "1.0.0-next.5", + "@floydspace/projen-components": "1.0.0-next.7", "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^7", "@typescript-eslint/parser": "^7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6a5c7d5..68fbe62f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: ^0.4.3 version: 0.4.3(tsx@4.16.5)(typescript@5.4.5) '@floydspace/projen-components': - specifier: 1.0.0-next.5 - version: 1.0.0-next.5(projen@0.82.8) + specifier: 1.0.0-next.7 + version: 1.0.0-next.7(projen@0.82.8) '@types/node': specifier: ^18 version: 18.19.14 @@ -3010,8 +3010,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@floydspace/projen-components@1.0.0-next.5(projen@0.82.8): - resolution: {integrity: sha512-hcQ5LCETKNaUqgxqS1vhUrOxI10lxRSyeuxEBmk3Ng622JO/39+u0vS/B0Y0bIJg+pxL9LB6oHYQ3BYUIovxyQ==} + /@floydspace/projen-components@1.0.0-next.7(projen@0.82.8): + resolution: {integrity: sha512-n4nWkUsg/rpweB+GLU91gF/2Xr2/GEkB+PUB1H5GwMHmwjS4LtSl/DLqlNPVrOP9+ZmScLd+S58EtNOSPYfCZw==} engines: {pnpm: '>=8 <9'} peerDependencies: projen: '>0.58.15' diff --git a/projenrc/monorepo-project.ts b/projenrc/monorepo-project.ts index a1ae277e..9852c626 100644 --- a/projenrc/monorepo-project.ts +++ b/projenrc/monorepo-project.ts @@ -16,10 +16,18 @@ export class MonorepoProject extends MonorepoTsProject { constructor(options: MonorepoProjectOptions) { super({ packageManager: NodePackageManager.PNPM, + pnpmVersion: "8", license: "MIT", licenseOptions: { disableDefaultLicenses: true, }, + github: true, + githubOptions: { mergify: false, pullRequestLint: false }, + buildWorkflow: true, + buildWorkflowOptions: { mutableBuild: false }, + pullRequestTemplate: false, + workflowNodeVersion: "lts/*", + workflowPackageCache: true, clobber: false, // enable it and run `pnpm default && pnpm clobber`, if you need to reset the project depsUpgrade: false, // enable it and run `pnpm default && pnpm upgrade` to upgrade projen and monorepo deps monorepoUpgradeDeps: false,