From ccc92f06187e8f6c7e053c149915e4d0db14a0bd Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 6 Aug 2025 14:33:08 +0200 Subject: [PATCH 1/5] feat: add setup-deno action, and add use_pnpm option to pnpm-publish action --- .github/CONTRIBUTING.md | 101 ++++++++++++++----- .github/PULL_REQUEST_TEMPLATE.md | 13 +++ .github/actions/check-dist/action.yaml | 6 +- .github/workflows/check-commit-messages.yaml | 12 +-- .github/workflows/check-dist.yaml | 34 ------- .github/workflows/check-formatting.yaml | 26 ----- .github/workflows/check-pr-title.yaml | 8 +- .github/workflows/generate-changelog.yaml | 18 ++-- .github/workflows/self-check-dist.yaml | 31 ++++++ .github/workflows/self-check-formatting.yaml | 23 +++++ .github/workflows/self-commitizen.yaml | 34 +++++++ README.md | 100 ++++++++++-------- actions/bump-version/README.md | 13 ++- actions/bump-version/action.yaml | 6 +- actions/check-commit-messages/README.md | 12 +-- actions/check-commit-messages/action.yaml | 4 +- actions/check-pr-title/README.md | 8 +- actions/check-pr-title/action.yaml | 4 +- actions/create-pr/README.md | 12 +-- actions/create-pr/action.yaml | 2 +- actions/generate-changelog/README.md | 12 +-- actions/generate-changelog/action.yaml | 4 +- actions/generate-release-notes/README.md | 12 +-- actions/generate-release-notes/action.yaml | 4 +- actions/is-beta-tag/README.md | 4 +- actions/is-beta-tag/action.yaml | 2 +- actions/npm-publish/README.md | 15 +-- actions/npm-publish/action.yaml | 12 ++- actions/setup-commitizen/README.md | 8 +- actions/setup-commitizen/action.yaml | 4 +- actions/setup-deno/README.md | 33 ++++++ actions/setup-deno/action.yaml | 27 +++++ actions/setup-pnpm/README.md | 8 +- actions/setup-pnpm/action.yaml | 14 +-- actions/setup-python/README.md | 4 +- actions/setup-python/action.yaml | 8 +- workflows/check-commit-messages/README.md | 2 +- workflows/check-pr-title/README.md | 2 +- workflows/generate-changelog/README.md | 2 +- 39 files changed, 408 insertions(+), 236 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/check-dist.yaml delete mode 100644 .github/workflows/check-formatting.yaml create mode 100644 .github/workflows/self-check-dist.yaml create mode 100644 .github/workflows/self-check-formatting.yaml create mode 100644 .github/workflows/self-commitizen.yaml create mode 100644 actions/setup-deno/README.md create mode 100644 actions/setup-deno/action.yaml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8494ec8..e97916f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -Thank you for your interest in contributing to this repo. +Thank you for your interest in contributing to DFINITY's CI Tools. By participating in this project, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md). As a member of the community, you are invited and encouraged to contribute by submitting issues, offering suggestions for improvements, adding review comments to existing pull requests, or creating new pull requests to fix issues. @@ -8,7 +8,7 @@ As a member of the community, you are invited and encouraged to contribute by su All contributions to DFINITY documentation and the developer community are respected and appreciated. Your participation is an important factor in the success of the Internet Computer. -## Before you contribute +## Prerequisites Before contributing, please take a few minutes to review these contributor guidelines. The contributor guidelines are intended to make the contribution process easy and effective for everyone involved in addressing your issue, assessing changes, and finalizing your pull requests. @@ -27,16 +27,7 @@ Before contributing, consider the following: If you are new to working with GitHub repositories and creating pull requests, consider exploring [First Contributions](https://github.com/firstcontributions/first-contributions) or [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github). -# How to make a contribution - -Depending on the type of contribution you want to make, you might follow different workflows. - -This section describes the most common workflow scenarios: - -- Reporting an issue -- Submitting a pull request - -### Reporting an issue +## Reporting an issue To open a new issue: @@ -45,35 +36,89 @@ To open a new issue: - Be as clear and descriptive as possible. - For any problem, describe it in detail, including details about the crate, the version of the code you are using, the results you expected, and how the actual results differed from your expectations. -### Submitting a pull request +## Submitting a pull request If you want to submit a pull request to fix an issue or add a feature, here's a summary of what you need to do: +### Forking the repository + 1. Make sure you have a GitHub account, an internet connection, and access to a terminal shell or GitHub Desktop application for running commands. 2. Navigate to the [repository's homepage](https://github.com/dfinity/ci-tools) in a web browser. 3. Click **Fork** to create a copy of the repository under your GitHub account or organization name. 4. Clone the forked repository to your local machine. -5. Create a new branch for your fix by running a command similar to the following: ```shell - git checkout -b my-branch-name-here + git clone "https://github.com/$YOUR_USERNAME/ci-tools.git" ``` -6. Open the file you want to fix in a text editor and make the appropriate changes for the issue you are trying to address. -7. Add the file contents of the changed files to the index `git` uses to manage the state of the project by running a command similar to the following: +5. Change into the directory of the cloned repository: ```shell - git add path-to-changed-file + cd ci-tools ``` -8. Commit your changes to store the contents you added to the index along with a descriptive message by running a command similar to the following: +6. Create a new branch for your fix by running a command similar to the + following: + ```shell + git checkout -b $YOUR_BRANCH_NAME + ``` + +### Install dependencies + +- Install [`fnm`](https://github.com/Schniz/fnm). + ```bash + curl -fsSL https://get.pnpm.io/install.sh | sh - + ``` +- Install the correct version of [`nodejs`](https://nodejs.org). + ```bash + fnm install + ``` +- Enable the correct version of `nodejs`. + ```bash + fnm use + ``` +- Set up the correct version of [`pnpm`](https://pnpm.io/). + ```bash + corepack enable + ``` +- Install dependencies: + ```bash + pnpm i + ``` + +### Making a pull request + +1. Open the file you want to fix in a text editor and make the appropriate changes for the issue you are trying to address. +2. Add the file contents of the changed files to the index `git` uses to manage the state of the project by running a command similar to the following: + ```shell + git add $PATH_TO_CHANGED_FILE + ``` +3. Make sure to have [Commitizen](https://commitizen-tools.github.io/commitizen/#installation) installed. +4. Commit your changes to store the contents you added to the index along with a descriptive message by running the following: ```shell cz commit ``` - - See [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for more information on the commit message formats. -9. Push the changes to the remote repository by running a command similar to the following: +5. Push the changes to the remote repository by running a command similar to the following: ```shell - git push origin my-branch-name-here + git push origin $YOUR_BRANCH_NAME ``` -10. Create a new pull request (PR) for the branch you pushed to the upstream GitHub repository. - - The PR title should be auto-populated based on your commit message. - - Provide a PR message that includes a short description of the changes made. -11. Wait for the pull request to be reviewed. -12. Make changes to the pull request, if requested. -13. Celebrate your success after your pull request is merged! +6. Create a new pull request (PR) for the branch you pushed to the upstream GitHub repository. + - The PR title should be auto-populated based on your commit message. + - Provide a PR message that includes a short description of the changes made. +7. Wait for the pull request to be reviewed. +8. Make changes to the pull request, if requested. When making subsequent commits, you no longer need to follow conventional commits. Only the first commit message will be used. +9. Celebrate your success after your pull request is merged! + +## Updating `pnpm` + +To update the version of `pnpm` that is used: + +```bash +corepack use pnpm@9.x +``` + +## Building + +Actions are built locally and the built files are committed to the repository. To build the actions, run: + +```bash +pnpm build +``` + +The GitHub actions pipeline will attempt to build the actions and check if there are any differences between the built files and those that are committed to the repository. If there are any differences, the pipeline will fail. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5080b2b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/.github/actions/check-dist/action.yaml b/.github/actions/check-dist/action.yaml index eb657f9..e9bee53 100644 --- a/.github/actions/check-dist/action.yaml +++ b/.github/actions/check-dist/action.yaml @@ -1,4 +1,4 @@ -name: 'Check dist' +name: Check dist description: 'Builds an action and ensures the `dist/` directory is up to date' inputs: @@ -9,12 +9,12 @@ inputs: runs: using: 'composite' steps: - - name: 'Build action' + - name: Build action shell: bash working-directory: actions/${{ inputs.action_name }} run: pnpm build - - name: 'Check action `dist` directory' + - name: Check action `dist` directory shell: bash working-directory: actions/${{ inputs.action_name }} run: | diff --git a/.github/workflows/check-commit-messages.yaml b/.github/workflows/check-commit-messages.yaml index 1e0f546..69d1e9c 100644 --- a/.github/workflows/check-commit-messages.yaml +++ b/.github/workflows/check-commit-messages.yaml @@ -1,4 +1,4 @@ -name: 'Check commit messages workflow' +name: Check commit messages workflow on: workflow_call: @@ -13,18 +13,18 @@ jobs: check_commit_messages: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Check commit messages' + - name: Check commit messages uses: dfinity/ci-tools/actions/check-commit-messages@main with: target_branch: ${{ inputs.target_branch }} diff --git a/.github/workflows/check-dist.yaml b/.github/workflows/check-dist.yaml deleted file mode 100644 index 400d9a9..0000000 --- a/.github/workflows/check-dist.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: 'Check Transpiled JavaScript' - -on: - pull_request: - branches: - - main - push: - branches: - - main - -permissions: - contents: read - -jobs: - check-dist: - name: 'Check dist/' - runs-on: ubuntu-latest - strategy: - matrix: - action_name: ['create-pr'] - steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 - - - name: 'Setup PNPM' - uses: ./actions/setup-pnpm - - - name: 'Build @dfinity/action-utils' - run: pnpm -F @dfinity/action-utils build - - - name: 'Check ${{ matrix.action_name }} dist folder' - uses: ./.github/actions/check-dist - with: - action_name: ${{ matrix.action_name }} diff --git a/.github/workflows/check-formatting.yaml b/.github/workflows/check-formatting.yaml deleted file mode 100644 index bd28f6c..0000000 --- a/.github/workflows/check-formatting.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: 'Check formatting' - -on: - pull_request: - branches: - - main - push: - branches: - - main - -permissions: - contents: read - -jobs: - check-formatting: - name: 'Check formatting' - runs-on: ubuntu-latest - steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 - - - name: 'Setup PNPM' - uses: ./actions/setup-pnpm - - - name: 'Check formatting' - run: pnpm run format:check diff --git a/.github/workflows/check-pr-title.yaml b/.github/workflows/check-pr-title.yaml index fa02622..a9f41b1 100644 --- a/.github/workflows/check-pr-title.yaml +++ b/.github/workflows/check-pr-title.yaml @@ -1,4 +1,4 @@ -name: 'Check PR title workflow' +name: Check PR title workflow on: workflow_call: @@ -7,11 +7,11 @@ jobs: check_pr_title: runs-on: ubuntu-latest steps: - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Check pull request title' + - name: Check pull request title uses: dfinity/ci-tools/actions/check-pr-title@main diff --git a/.github/workflows/generate-changelog.yaml b/.github/workflows/generate-changelog.yaml index 7ed8044..9e92c74 100644 --- a/.github/workflows/generate-changelog.yaml +++ b/.github/workflows/generate-changelog.yaml @@ -1,4 +1,4 @@ -name: 'Generate changelog workflow' +name: Generate changelog workflow on: workflow_call: @@ -61,30 +61,30 @@ jobs: generate_changelog: runs-on: ubuntu-latest steps: - - name: 'Create GitHub App Token' - uses: actions/create-github-app-token@v1 + - name: Create GitHub App Token + uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 id: generate_token with: app-id: ${{ inputs.token_app_id }} private-key: ${{ secrets.token_private_key }} - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Generate changelog' + - name: Generate changelog uses: dfinity/ci-tools/actions/generate-changelog@main with: file_name: ${{ inputs.file_name }} - - name: 'Create pull request' + - name: Create pull request uses: dfinity/ci-tools/actions/create-pr@main with: branch_name: ${{ inputs.branch_name }} diff --git a/.github/workflows/self-check-dist.yaml b/.github/workflows/self-check-dist.yaml new file mode 100644 index 0000000..edcbcf0 --- /dev/null +++ b/.github/workflows/self-check-dist.yaml @@ -0,0 +1,31 @@ +name: Check Transpiled JavaScript + +on: + merge_group: + pull_request: + +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + check_dist: + name: check_dist:required + runs-on: ubuntu-latest + strategy: + matrix: + action_name: ['create-pr'] + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup PNPM + uses: ./actions/setup-pnpm + + - name: Build @dfinity/action-utils + run: pnpm -F @dfinity/action-utils build + + - name: Check ${{ matrix.action_name }} dist folder + uses: ./.github/actions/check-dist + with: + action_name: ${{ matrix.action_name }} diff --git a/.github/workflows/self-check-formatting.yaml b/.github/workflows/self-check-formatting.yaml new file mode 100644 index 0000000..21dfc28 --- /dev/null +++ b/.github/workflows/self-check-formatting.yaml @@ -0,0 +1,23 @@ +name: Check Formatting + +on: + merge_group: + pull_request: + +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + check_formatting: + name: check_formatting:required + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup PNPM + uses: ./actions/setup-pnpm + + - name: Check formatting + run: pnpm run format:check diff --git a/.github/workflows/self-commitizen.yaml b/.github/workflows/self-commitizen.yaml new file mode 100644 index 0000000..7db79ad --- /dev/null +++ b/.github/workflows/self-commitizen.yaml @@ -0,0 +1,34 @@ +name: Commitizen + +on: + merge_group: + pull_request: + +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + check_pr_title: + if: github.event_name == 'pull_request' + uses: dfinity/ci-tools/.github/workflows/check-pr-title.yaml@main + + check_commit_messages: + if: github.event_name == 'merge_group' + uses: dfinity/ci-tools/.github/workflows/check-commit-messages.yaml@main + + commitizen: + name: commitizen:required + runs-on: ubuntu-latest + needs: [check_pr_title, check_commit_messages] + if: always() + steps: + - name: Check previous jobs + run: | + if [[ "${{ needs.check_pr_title.result }}" == "success" || "${{ needs.check_pr_title.result }}" == "skipped" ]] && + [[ "${{ needs.check_commit_messages.result }}" == "success" || "${{ needs.check_commit_messages.result }}" == "skipped" ]]; then + echo "All required jobs passed or were skipped." + else + echo "One or more jobs failed." + exit 1 + fi diff --git a/README.md b/README.md index 69861da..6427ba0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Shared GitHub workflows and actions for DFINITY repositories. - [Is beta tag](./actions/is-beta-tag/README.md) - [NPM publish](./actions/npm-publish/README.md) - [Setup Commitizen](./actions/setup-commitizen/README.md) +- [Setup Deno](./actions/setup-deno/README.md) - [Setup pnpm](./actions/setup-pnpm/README.md) - [Setup Python](./actions/setup-python/README.md) @@ -48,6 +49,57 @@ Example: name: my_action:required ``` +## Locking Versions + +When referencing 3rd party actions, use a specific commit SHA to lock the version. This ensures that the action will not change unexpectedly, which could lead to breaking changes in your workflows. + +```yaml +name: checkout_repo + +on: + push: + branches: + - main + +jobs: + checkout_repo: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 +``` + +## Managing Concurrency + +For workflows that run on pull requests, use the `concurrency` key to ensure that only one workflow runs at a time for a given pull request. This prevents multiple workflows from running simultaneously and potentially causing conflicts. + +```yaml +name: commitizen + +on: + merge_group: + pull_request: + +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true +``` + +For workflows that perform deployments or releases, setup concurrency to ensure that only one deployment or release is in progress at a time. This prevents multiple deployments or releases from being triggered simultaneously, which could lead to inconsistencies. + +```yaml +name: release + +on: + push: + branches: + - main + +concurrency: + group: production + cancel-in-progress: false +``` + ## Using Commitizen ### Configuration @@ -80,7 +132,10 @@ version.workspace = true Create the `.github/repo_policies/BOT_APPROVED_FILES` file and add the following content: -```plaintext +```text +# List of approved files that can be changed by a bot via an automated PR. +# This is to increase security and prevent accidentally updating files that shouldn't be changed by a bot. + .cz.yaml CHANGELOG.md Cargo.lock @@ -174,45 +229,8 @@ jobs: ## Contributing -Check out the [contribution guidelines](./.github/CONTRIBUTING.md). - -## Setup - -- Install [`fnm`](https://github.com/Schniz/fnm). - ```bash - curl -fsSL https://get.pnpm.io/install.sh | sh - - ``` -- Install the correct version of [`nodejs`](https://nodejs.org). - ```bash - fnm install - ``` -- Enable the correct version of `nodejs`. - ```bash - fnm use - ``` -- Set up the correct version of [`pnpm`](https://pnpm.io/). - ```bash - corepack enable - ``` -- Install dependencies: - ```bash - pnpm i - ``` - -### Updating `pnpm` - -To update the version of `pnpm` that is used: - -```bash -corepack use pnpm@9.x -``` - -### Building +Contributions are welcome! Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md), where you can find all you need to know to contribute to this project. -Actions are built locally and the built files are committed to the repository. To build the actions, run: - -```bash -pnpm build -``` +## License -The GitHub actions pipeline will attempt to build the actions and check if there are any differences between the built files and those that are committed to the repository. If there are any differences, the pipeline will fail. +This project is licensed under the [Apache-2.0 License](LICENSE). diff --git a/actions/bump-version/README.md b/actions/bump-version/README.md index 761cf38..825df11 100644 --- a/actions/bump-version/README.md +++ b/actions/bump-version/README.md @@ -16,7 +16,7 @@ This action bumps package versions based on the repository's commit messages wri ## Example usage ```yaml -name: 'Bump version' +name: Bump version on: push: @@ -27,22 +27,21 @@ jobs: bump_version: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Bump version' + - name: Bump version id: bump_version uses: dfinity/ci-tools/actions/bump-version@main - - name: 'Print version' + - name: Print version run: | echo "New version: ${{ steps.bump_version.outputs.version }}" ``` diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index c033180..483a3ea 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -1,4 +1,4 @@ -name: 'Bump version' +name: Bump version description: "This action bumps package versions based on the repository's commit messages written according to the Conventional Commits specification." inputs: @@ -20,7 +20,7 @@ outputs: runs: using: composite steps: - - name: 'Get next version' + - name: Get next version id: get_version shell: bash env: @@ -40,7 +40,7 @@ runs: version=$($cmd) echo "version=$version" >> "$GITHUB_OUTPUT" - - name: 'Generate changelog' + - name: Generate changelog shell: bash env: PRERELEASE: ${{ inputs.prerelease }} diff --git a/actions/check-commit-messages/README.md b/actions/check-commit-messages/README.md index ae5ffa5..337d4a3 100644 --- a/actions/check-commit-messages/README.md +++ b/actions/check-commit-messages/README.md @@ -13,7 +13,7 @@ There is also a ready-to-use [workflow](../../workflows/check-commit-messages/RE ## Example usage ```yaml -name: 'Check commit messages' +name: Check commit messages on: push: @@ -25,18 +25,18 @@ jobs: check_commit_messages: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Check commit messages' + - name: Check commit messages uses: dfinity/ci-tools/actions/check-commit-messages@main with: target_branch: 'develop' diff --git a/actions/check-commit-messages/action.yaml b/actions/check-commit-messages/action.yaml index d01fc60..7443a10 100644 --- a/actions/check-commit-messages/action.yaml +++ b/actions/check-commit-messages/action.yaml @@ -1,4 +1,4 @@ -name: 'Check commit messages' +name: Check commit messages description: 'This action checks the commit messages on a branch to ensure they follow the Conventional Commits specification.' inputs: @@ -10,7 +10,7 @@ inputs: runs: using: composite steps: - - name: 'Check commit messages' + - name: Check commit messages shell: bash env: TARGET_BRANCH: ${{ inputs.target_branch }} diff --git a/actions/check-pr-title/README.md b/actions/check-pr-title/README.md index 2ef674b..2191dac 100644 --- a/actions/check-pr-title/README.md +++ b/actions/check-pr-title/README.md @@ -13,7 +13,7 @@ There is also a ready-to-use [workflow](../../workflows/check-pr-title/README.md ## Example usage ```yaml -name: 'Check pull request title' +name: Check pull request title on: pull_request: @@ -22,13 +22,13 @@ jobs: check_pr_title: runs-on: ubuntu-latest steps: - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Check pull request title' + - name: Check pull request title uses: dfinity/ci-tools/actions/check-pr-title@main with: include_description: false diff --git a/actions/check-pr-title/action.yaml b/actions/check-pr-title/action.yaml index 92f5fa6..24ede06 100644 --- a/actions/check-pr-title/action.yaml +++ b/actions/check-pr-title/action.yaml @@ -1,4 +1,4 @@ -name: 'Check pull request title' +name: Check pull request title description: 'This action checks the title of a pull request to ensure it follows the Conventional Commits specification.' inputs: @@ -11,7 +11,7 @@ inputs: runs: using: composite steps: - - name: 'Check pull request title' + - name: Check pull request title shell: bash env: PR_TITLE: ${{ github.event.pull_request.title }} diff --git a/actions/create-pr/README.md b/actions/create-pr/README.md index fb8ed1d..a2f0c47 100644 --- a/actions/create-pr/README.md +++ b/actions/create-pr/README.md @@ -33,7 +33,7 @@ packages/some-package/package.json ## Example usage ```yaml -name: 'Create pull request' +name: Create pull request on: push: @@ -44,17 +44,17 @@ jobs: create_pr: runs-on: ubuntu-latest steps: - - name: 'Create GitHub App Token' - uses: actions/create-github-app-token@v1 + - name: Create GitHub App Token + uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 id: generate_token with: app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: 'Create pull request' + - name: Create pull request uses: dfinity/ci-tools/actions/create-pr@main with: branch_name: 'chore/generate-changelog' diff --git a/actions/create-pr/action.yaml b/actions/create-pr/action.yaml index 96c89ec..11b791b 100644 --- a/actions/create-pr/action.yaml +++ b/actions/create-pr/action.yaml @@ -1,4 +1,4 @@ -name: 'Create pull request' +name: Create pull request description: 'This action creates a pull request from a branch to a target branch.' author: 'DFINITY Stiftung' diff --git a/actions/generate-changelog/README.md b/actions/generate-changelog/README.md index 1f82a08..d516161 100644 --- a/actions/generate-changelog/README.md +++ b/actions/generate-changelog/README.md @@ -13,7 +13,7 @@ There is also a ready-to-use [workflow](../../workflows/generate-changelog/READM ## Example usage ```yaml -name: 'Generate changelog' +name: Generate changelog on: push: @@ -24,18 +24,18 @@ jobs: generate_changelog: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Generate changelog' + - name: Generate changelog uses: dfinity/ci-tools/actions/generate-changelog@main with: file_name: 'CHANGES.md' diff --git a/actions/generate-changelog/action.yaml b/actions/generate-changelog/action.yaml index ffa1cfd..e282a12 100644 --- a/actions/generate-changelog/action.yaml +++ b/actions/generate-changelog/action.yaml @@ -1,4 +1,4 @@ -name: 'Generate changelog' +name: Generate changelog description: "This action generates changelog based on the repository's commit messages written according to the Conventional Commits specification." inputs: @@ -10,7 +10,7 @@ inputs: runs: using: composite steps: - - name: 'Generate changelog' + - name: Generate changelog shell: bash env: FILE_NAME: ${{ inputs.file_name }} diff --git a/actions/generate-release-notes/README.md b/actions/generate-release-notes/README.md index 49f23c0..63a12c9 100644 --- a/actions/generate-release-notes/README.md +++ b/actions/generate-release-notes/README.md @@ -12,7 +12,7 @@ This action generates release notes based on the repository's commit messages ac ## Example usage ```yaml -name: 'Generate release notes' +name: Generate release notes on: push: @@ -23,18 +23,18 @@ jobs: generate_release_notes: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main - - name: 'Generate release notes' + - name: Generate release notes uses: dfinity/ci-tools/actions/generate-release-notes@main with: file_name: 'RELEASE.md' diff --git a/actions/generate-release-notes/action.yaml b/actions/generate-release-notes/action.yaml index faac3ec..098529b 100644 --- a/actions/generate-release-notes/action.yaml +++ b/actions/generate-release-notes/action.yaml @@ -1,4 +1,4 @@ -name: 'Generate release notes' +name: Generate release notes description: "This action generates release notes based on the repository's commit messages written according to the Conventional Commits specification." inputs: @@ -15,7 +15,7 @@ inputs: runs: using: composite steps: - - name: 'Generate changelog' + - name: Generate changelog shell: bash env: FILE_NAME: ${{ inputs.file_name }} diff --git a/actions/is-beta-tag/README.md b/actions/is-beta-tag/README.md index 7e8a252..398ffdd 100644 --- a/actions/is-beta-tag/README.md +++ b/actions/is-beta-tag/README.md @@ -23,14 +23,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Is beta tag id: is_beta_tag uses: dfinity/ci-tools/actions/is-beta-tag@main - name: Create Github release - uses: ncipollo/release-action@v1 + uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0 with: tag: '${{ github.ref_name }}' commit: 'main' diff --git a/actions/is-beta-tag/action.yaml b/actions/is-beta-tag/action.yaml index b5977be..7813acd 100644 --- a/actions/is-beta-tag/action.yaml +++ b/actions/is-beta-tag/action.yaml @@ -1,4 +1,4 @@ -name: 'Is beta tag' +name: Is beta tag description: 'This action checks if the current git tag uses the beta release format. The expected format is `${majorVersion}.${minorVersion}.${patchVersion}b${betaVersion}`.' outputs: diff --git a/actions/npm-publish/README.md b/actions/npm-publish/README.md index d6edc78..9b463fd 100644 --- a/actions/npm-publish/README.md +++ b/actions/npm-publish/README.md @@ -1,13 +1,14 @@ # NPM publish -This action publishes a package to the npm registry. It assumes that `npm` is already setup, see the [setup PNPM action](../setup-pnpm/README.md) for a ready to use action to do this. +This action publishes a package to the npm registry. It assumes that `npm` and `pnpm` is already setup, see the [setup PNPM action](../setup-pnpm/README.md) for a ready to use action to do this. ## Action inputs -| Input | Description | Default | -| --------- | --------------------------------------------------------------------- | ---------- | -| `token` | The npm token to authenticate with the npm registry. | _required_ | -| `is_beta` | Publish the package as a beta version. Expects a stringified boolean. | `'false'` | +| Input | Description | Default | +| ---------- | --------------------------------------------------------------------- | ---------- | +| `token` | The npm token to authenticate with the npm registry. | _required_ | +| `is_beta` | Publish the package as a beta version. Expects a stringified boolean. | `'false'` | +| `use_pnpm` | Use `pnpm` instead of `npm` for publishing. | `'false'` | ## Action outputs @@ -30,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup PNPM uses: dfinity/ci-tools/actions/setup-pnpm@main @@ -48,7 +49,7 @@ jobs: is_beta: ${{ steps.is_beta_tag.outputs.is_beta_tag }} - name: Create Github release - uses: ncipollo/release-action@v1 + uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0 with: artifacts: ${{ steps.publish_dfinity_cns.outputs.artifact_filepath }} tag: '${{ github.ref_name }}' diff --git a/actions/npm-publish/action.yaml b/actions/npm-publish/action.yaml index f6a7296..d257aa9 100644 --- a/actions/npm-publish/action.yaml +++ b/actions/npm-publish/action.yaml @@ -1,4 +1,4 @@ -name: 'NPM publish' +name: NPM publish description: 'This action publishes a package to the npm registry.' inputs: @@ -9,6 +9,10 @@ inputs: description: 'A stringified boolean indicating whether to publish the package as a beta version.' required: false default: 'false' + use_pnpm: + description: 'A stringified boolean indicating whether to use pnpm for publishing.' + required: false + default: 'false' outputs: artifact_filepath: @@ -25,10 +29,12 @@ runs: IS_BETA: ${{ inputs.is_beta }} shell: bash run: | - artifact_filepath=$(pwd)/$(npm pack --json | jq -r '.[0].filename') + pkg_mngr=$(if [ "${{ inputs.use_pnpm }}" = 'true' ]; then echo 'pnpm'; else echo 'npm'; fi) + + artifact_filepath=$(pwd)/$($pkg_mngr pack --json | jq -r '.[0].filename') echo "artifact_filepath=$artifact_filepath" >> "$GITHUB_OUTPUT" - release_cmd="npm publish --access public" + release_cmd="$pkg_mngr publish --access public" if [ "$IS_BETA" = 'true' ]; then release_cmd="$release_cmd --tag beta" fi diff --git a/actions/setup-commitizen/README.md b/actions/setup-commitizen/README.md index c6ab75f..8bed46b 100644 --- a/actions/setup-commitizen/README.md +++ b/actions/setup-commitizen/README.md @@ -17,12 +17,12 @@ jobs: setup_commitizen: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: 'Setup Python' + - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main - - name: 'Setup Commitizen' + - name: Setup Commitizen uses: dfinity/ci-tools/actions/setup-commitizen@main ``` diff --git a/actions/setup-commitizen/action.yaml b/actions/setup-commitizen/action.yaml index d6c1af5..72c90c4 100644 --- a/actions/setup-commitizen/action.yaml +++ b/actions/setup-commitizen/action.yaml @@ -1,9 +1,9 @@ -name: 'Setup Commitizen' +name: Setup Commitizen description: 'This action sets up Commitizen for use in actions.' runs: using: composite steps: - - name: 'Install Commitzen' + - name: Install Commitzen shell: bash run: pip install -U Commitizen diff --git a/actions/setup-deno/README.md b/actions/setup-deno/README.md new file mode 100644 index 0000000..fd34d26 --- /dev/null +++ b/actions/setup-deno/README.md @@ -0,0 +1,33 @@ +# Setup Deno action + +This action sets up [Deno](https://deno.com/) for use in actions. The version of +`deno` defaults to `v2.x`. + +## Action inputs + +| Input | Description | Default | +| ------------------- | -------------------------------------------------------- | -------- | +| `deno_version_file` | The path to the file containing the Deno version to use. | `''` | +| `deno_version` | The specific Deno version to use. | `'v2.x'` | + +## Example usage + +```yaml +name: Setup Deno + +on: + push: + branches: + - main + pull_request: + +jobs: + setup_pnpm: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup Deno + uses: dfinity/ci-tools/actions/setup-deno@main +``` diff --git a/actions/setup-deno/action.yaml b/actions/setup-deno/action.yaml new file mode 100644 index 0000000..47825d4 --- /dev/null +++ b/actions/setup-deno/action.yaml @@ -0,0 +1,27 @@ +name: Setup Deno +description: 'This action sets up [Deno](https://deno.com/) for use in actions.' + +inputs: + deno_version_file: + description: 'Set a deno version file to determine the Deno version to use' + required: false + default: '' + + deno_version: + description: 'Set a specific Deno version to use' + required: false + default: 'v2.x' + +runs: + using: composite + steps: + - name: Install Deno + uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3 + with: + cache: true + deno-version: ${{ inputs.deno_version }} + deno-version-file: ${{ inputs.deno_version_file }} + + - name: Install dependencies + shell: bash + run: deno i --frozen=true diff --git a/actions/setup-pnpm/README.md b/actions/setup-pnpm/README.md index a9c9384..333d06d 100644 --- a/actions/setup-pnpm/README.md +++ b/actions/setup-pnpm/README.md @@ -12,7 +12,7 @@ This action sets up [pnpm](https://pnpm.io/) for use in actions. The version of ## Example usage ```yaml -name: 'Setup PNPM' +name: Setup PNPM on: push: @@ -24,10 +24,10 @@ jobs: setup_pnpm: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: 'Setup PNPM' + - name: Setup PNPM uses: dfinity/ci-tools/actions/setup-pnpm@main with: node_version_file: '.nvmrc' diff --git a/actions/setup-pnpm/action.yaml b/actions/setup-pnpm/action.yaml index ce82322..0bf4fb4 100644 --- a/actions/setup-pnpm/action.yaml +++ b/actions/setup-pnpm/action.yaml @@ -1,4 +1,4 @@ -name: 'Setup pnpm' +name: Setup pnpm description: 'This action sets up [pnpm](https://pnpm.io/) for use in actions.' inputs: @@ -15,17 +15,19 @@ inputs: runs: using: composite steps: - - name: 'Install pnpm' - uses: pnpm/action-setup@v3 + - name: Install pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + with: + run_install: false - - name: 'Install Node.js' - uses: actions/setup-node@v4 + - name: Install Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ inputs.node_version }} node-version-file: ${{ inputs.node_version_file }} registry-url: 'https://registry.npmjs.org' cache: pnpm - - name: 'Install dependencies' + - name: Install dependencies shell: bash run: pnpm i --frozen-lockfile diff --git a/actions/setup-python/README.md b/actions/setup-python/README.md index 448ed10..11bafb7 100644 --- a/actions/setup-python/README.md +++ b/actions/setup-python/README.md @@ -17,8 +17,8 @@ jobs: setup_python: runs-on: ubuntu-latest steps: - - name: 'Checkout repository' - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Python uses: dfinity/ci-tools/actions/setup-python@main diff --git a/actions/setup-python/action.yaml b/actions/setup-python/action.yaml index b2d44a0..81722cb 100644 --- a/actions/setup-python/action.yaml +++ b/actions/setup-python/action.yaml @@ -1,14 +1,14 @@ -name: 'Setup Python' +name: Setup Python description: 'This action sets up Python and pip for use in actions.' runs: using: 'composite' steps: - - name: 'Install Python' - uses: actions/setup-python@v5 + - name: Install Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: '3.13' - - name: 'Install PIP' + - name: Install PIP shell: bash run: python -m pip install --upgrade pip diff --git a/workflows/check-commit-messages/README.md b/workflows/check-commit-messages/README.md index 2f8267e..45cd97e 100644 --- a/workflows/check-commit-messages/README.md +++ b/workflows/check-commit-messages/README.md @@ -11,7 +11,7 @@ This workflow checks the commit messages on a branch to ensure they follow the [ ## Example usage ```yaml -name: 'Check commit messages' +name: Check commit messages on: push: diff --git a/workflows/check-pr-title/README.md b/workflows/check-pr-title/README.md index 06fdf8f..f64e6fc 100644 --- a/workflows/check-pr-title/README.md +++ b/workflows/check-pr-title/README.md @@ -5,7 +5,7 @@ This workflow checks the title of a pull request to ensure it follows the [Conve ## Example usage ```yaml -name: 'Check PR title' +name: Check PR title on: pull_request: diff --git a/workflows/generate-changelog/README.md b/workflows/generate-changelog/README.md index 1cd75da..98c7dee 100644 --- a/workflows/generate-changelog/README.md +++ b/workflows/generate-changelog/README.md @@ -30,7 +30,7 @@ CHANGELOG.md ## Example usage ```yaml -name: 'Generate changelog' +name: Generate changelog on: push: From 76ad6f63b3d040894838f4dec62042ebdfc80519 Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 6 Aug 2025 14:42:15 +0200 Subject: [PATCH 2/5] Add self generate changelog pipeline --- .github/workflows/self-commitizen.yaml | 4 ++-- .github/workflows/self-generate-changelog.yaml | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/self-generate-changelog.yaml diff --git a/.github/workflows/self-commitizen.yaml b/.github/workflows/self-commitizen.yaml index 7db79ad..2756c85 100644 --- a/.github/workflows/self-commitizen.yaml +++ b/.github/workflows/self-commitizen.yaml @@ -11,11 +11,11 @@ concurrency: jobs: check_pr_title: if: github.event_name == 'pull_request' - uses: dfinity/ci-tools/.github/workflows/check-pr-title.yaml@main + uses: ./.github/workflows/check-pr-title.yaml check_commit_messages: if: github.event_name == 'merge_group' - uses: dfinity/ci-tools/.github/workflows/check-commit-messages.yaml@main + uses: ./.github/workflows/check-commit-messages.yaml commitizen: name: commitizen:required diff --git a/.github/workflows/self-generate-changelog.yaml b/.github/workflows/self-generate-changelog.yaml new file mode 100644 index 0000000..7cca816 --- /dev/null +++ b/.github/workflows/self-generate-changelog.yaml @@ -0,0 +1,14 @@ +name: Generate changelog + +on: + push: + branches: + - main + +jobs: + generate_changelog: + uses: ./.github/workflows/generate-changelog.yaml + with: + token_app_id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} + secrets: + token_private_key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} From 4c8c23e75b5bb8160d6ac28a842bfb09ec50e2a4 Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 6 Aug 2025 14:50:12 +0200 Subject: [PATCH 3/5] add cz.json and BOT_APPROVED_FILES --- .github/repo_policies/BOT_APPROVED_FILES | 5 +++++ .github/workflows/self-generate-changelog.yaml | 4 ++++ README.md | 4 ++++ cz.json | 8 ++++++++ workflows/check-commit-messages/README.md | 7 ++++--- workflows/check-pr-title/README.md | 4 ++++ workflows/generate-changelog/README.md | 4 ++++ 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/repo_policies/BOT_APPROVED_FILES create mode 100644 cz.json diff --git a/.github/repo_policies/BOT_APPROVED_FILES b/.github/repo_policies/BOT_APPROVED_FILES new file mode 100644 index 0000000..ef1ed5b --- /dev/null +++ b/.github/repo_policies/BOT_APPROVED_FILES @@ -0,0 +1,5 @@ +# List of approved files that can be changed by a bot via an automated PR. +# This is to increase security and prevent accidentally updating files that shouldn't be changed by a bot. + +cz.json +CHANGELOG.md diff --git a/.github/workflows/self-generate-changelog.yaml b/.github/workflows/self-generate-changelog.yaml index 7cca816..b238d60 100644 --- a/.github/workflows/self-generate-changelog.yaml +++ b/.github/workflows/self-generate-changelog.yaml @@ -5,6 +5,10 @@ on: branches: - main +concurrency: + group: main-${{ github.workflow }} + cancel-in-progress: true + jobs: generate_changelog: uses: ./.github/workflows/generate-changelog.yaml diff --git a/README.md b/README.md index 6427ba0..026d435 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,10 @@ on: merge_group: pull_request: +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + jobs: check_pr_title: name: check_pr_title diff --git a/cz.json b/cz.json new file mode 100644 index 0000000..55fb141 --- /dev/null +++ b/cz.json @@ -0,0 +1,8 @@ +{ + "commitizen": { + "name": "cz_conventional_commits", + "tag_format": "$version", + "version_scheme": "semver", + "version": "0.0.1" + } +} diff --git a/workflows/check-commit-messages/README.md b/workflows/check-commit-messages/README.md index 45cd97e..f6ac581 100644 --- a/workflows/check-commit-messages/README.md +++ b/workflows/check-commit-messages/README.md @@ -14,11 +14,12 @@ This workflow checks the commit messages on a branch to ensure they follow the [ name: Check commit messages on: - push: - branches: - - main pull_request: +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + jobs: check_commit_messages: uses: dfinity/ci-tools/.github/workflows/check-commit-messages.yaml@main diff --git a/workflows/check-pr-title/README.md b/workflows/check-pr-title/README.md index f64e6fc..3c25889 100644 --- a/workflows/check-pr-title/README.md +++ b/workflows/check-pr-title/README.md @@ -10,6 +10,10 @@ name: Check PR title on: pull_request: +concurrency: + group: pr-${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + jobs: check_pr_title: uses: dfinity/ci-tools/.github/workflows/check-pr-title.yaml@main diff --git a/workflows/generate-changelog/README.md b/workflows/generate-changelog/README.md index 98c7dee..ea0482d 100644 --- a/workflows/generate-changelog/README.md +++ b/workflows/generate-changelog/README.md @@ -37,6 +37,10 @@ on: branches: - main +concurrency: + group: main-${{ github.workflow }} + cancel-in-progress: true + jobs: generate_changelog: uses: dfinity/ci-tools/.github/workflows/generate-changelog.yaml@main From 34588509e0ecab61cb725c67d7e974fdaad09e60 Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 6 Aug 2025 19:15:35 +0200 Subject: [PATCH 4/5] allow setting any package manager --- actions/npm-publish/README.md | 10 +++++----- actions/npm-publish/action.yaml | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/actions/npm-publish/README.md b/actions/npm-publish/README.md index 9b463fd..f2b440b 100644 --- a/actions/npm-publish/README.md +++ b/actions/npm-publish/README.md @@ -4,11 +4,11 @@ This action publishes a package to the npm registry. It assumes that `npm` and ` ## Action inputs -| Input | Description | Default | -| ---------- | --------------------------------------------------------------------- | ---------- | -| `token` | The npm token to authenticate with the npm registry. | _required_ | -| `is_beta` | Publish the package as a beta version. Expects a stringified boolean. | `'false'` | -| `use_pnpm` | Use `pnpm` instead of `npm` for publishing. | `'false'` | +| Input | Description | Default | +| ----------------- | --------------------------------------------------------------------- | ---------- | +| `token` | The npm token to authenticate with the npm registry. | _required_ | +| `is_beta` | Publish the package as a beta version. Expects a stringified boolean. | `'false'` | +| `package_manager` | The package manager to use for publishing. | `'npm'` | ## Action outputs diff --git a/actions/npm-publish/action.yaml b/actions/npm-publish/action.yaml index d257aa9..0b6b85c 100644 --- a/actions/npm-publish/action.yaml +++ b/actions/npm-publish/action.yaml @@ -9,10 +9,10 @@ inputs: description: 'A stringified boolean indicating whether to publish the package as a beta version.' required: false default: 'false' - use_pnpm: - description: 'A stringified boolean indicating whether to use pnpm for publishing.' + package_manager: + description: 'The package manager to use for publishing.' required: false - default: 'false' + default: 'npm' outputs: artifact_filepath: @@ -29,12 +29,10 @@ runs: IS_BETA: ${{ inputs.is_beta }} shell: bash run: | - pkg_mngr=$(if [ "${{ inputs.use_pnpm }}" = 'true' ]; then echo 'pnpm'; else echo 'npm'; fi) - - artifact_filepath=$(pwd)/$($pkg_mngr pack --json | jq -r '.[0].filename') + artifact_filepath=$(pwd)/$(${{ inputs.package_manager }} pack --json | jq -r '.[0].filename') echo "artifact_filepath=$artifact_filepath" >> "$GITHUB_OUTPUT" - release_cmd="$pkg_mngr publish --access public" + release_cmd="${{ inputs.package_manager }} publish --access public" if [ "$IS_BETA" = 'true' ]; then release_cmd="$release_cmd --tag beta" fi From 1052ba022d4c9e11e0265ca2d61b7ebc01804cfd Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 6 Aug 2025 20:11:11 +0200 Subject: [PATCH 5/5] fix minor issues in docs --- .github/CONTRIBUTING.md | 7 ++----- package.json | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e97916f..7e40f0b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -56,15 +56,12 @@ If you want to submit a pull request to fix an issue or add a feature, here's a 6. Create a new branch for your fix by running a command similar to the following: ```shell - git checkout -b $YOUR_BRANCH_NAME + git switch -c $YOUR_BRANCH_NAME ``` ### Install dependencies - Install [`fnm`](https://github.com/Schniz/fnm). - ```bash - curl -fsSL https://get.pnpm.io/install.sh | sh - - ``` - Install the correct version of [`nodejs`](https://nodejs.org). ```bash fnm install @@ -110,7 +107,7 @@ If you want to submit a pull request to fix an issue or add a feature, here's a To update the version of `pnpm` that is used: ```bash -corepack use pnpm@9.x +corepack use pnpm@10.x ``` ## Building diff --git a/package.json b/package.json index f3eb439..1e04666 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,10 @@ "private": true, "engines": { "node": "^20", - "pnpm": "^9", + "pnpm": "^10", "npm": "please use pnpm" }, - "packageManager": "pnpm@9.12.3+sha256.24235772cc4ac82a62627cd47f834c72667a2ce87799a846ec4e8e555e2d4b8b", + "packageManager": "pnpm@10.14.0+sha256.297534e65d5842450539c1e8022c8831ab5e1fe2eb74664787a815519542d620", "scripts": { "build": "pnpm run -r build", "format": "prettier --write .",