diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d66fe08..abd4632 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,7 @@ jobs: steps: - name: Tell if project is using npm or yarn id: step1 - uses: garronej/ts-ci@v1.1.9 + uses: garronej/ts-ci@v2.0.0 with: action_name: tell_if_project_uses_npm_or_yarn - uses: actions/checkout@v3 @@ -65,9 +65,9 @@ jobs: from_version: ${{ steps.step1.outputs.from_version }} to_version: ${{ steps.step1.outputs.to_version }} is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} - is_release_beta: ${{steps.step1.outputs.is_release_beta }} + is_pre_release: ${{steps.step1.outputs.is_pre_release }} steps: - - uses: garronej/ts-ci@v1.1.9 + - uses: garronej/ts-ci@v2.0.0 id: step1 with: action_name: is_package_json_version_upgraded @@ -75,13 +75,13 @@ jobs: create_github_release: runs-on: ubuntu-latest - # We create a release only if the version have been upgraded and we are on a default branch - # PR on the default branch can release beta but not real release + # We create a release only if the version have been upgraded and we are on the main branch + # or if we are on a branch of the repo that has an PR open on main. if: | needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && ( github.event_name == 'push' || - needs.check_if_version_upgraded.outputs.is_release_beta == 'true' + needs.check_if_version_upgraded.outputs.is_pre_release == 'true' ) needs: - check_if_version_upgraded @@ -93,7 +93,7 @@ jobs: target_commitish: ${{ github.head_ref || github.ref }} generate_release_notes: true draft: false - prerelease: ${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }} + prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -131,11 +131,11 @@ jobs: false fi EXTRA_ARGS="" - if [ "$IS_BETA" = "true" ]; then - EXTRA_ARGS="--tag beta" + if [ "$IS_PRE_RELEASE" = "true" ]; then + EXTRA_ARGS="--tag next" fi npm publish $EXTRA_ARGS env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} - IS_BETA: ${{ needs.check_if_version_upgraded.outputs.is_release_beta }} + IS_PRE_RELEASE: ${{ needs.check_if_version_upgraded.outputs.is_pre_release }} diff --git a/.github/workflows/template_initialization.yaml b/.github/workflows/template_initialization.yaml index aa29e25..5e7e7be 100644 --- a/.github/workflows/template_initialization.yaml +++ b/.github/workflows/template_initialization.yaml @@ -12,7 +12,7 @@ jobs: - name: Checking availability for module name ${{github.event.repository.name}} on NPM. id: id1 - uses: garronej/ts-ci@v1.1.9 + uses: garronej/ts-ci@v2.0.0 with: action_name: is_well_formed_and_available_module_name module_name: ${{github.event.repository.name}} @@ -38,7 +38,7 @@ jobs: mv LICENSE.template LICENSE - name : String replace id: id2 - uses: garronej/ts-ci@v1.1.9 + uses: garronej/ts-ci@v2.0.0 with: action_name: string_replace input_string: ${{github.event.repository.name}} diff --git a/README.md b/README.md index cf6b169..fd43443 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,9 @@ https://user-images.githubusercontent.com/6702424/167035748-4fe28710-ed0f-4feb-a - Go to the repository ``Settings`` tab, then ``Secrets`` you will need to add a new secret: ``NPM_TOKEN``, you NPM authorization token. - To trigger publishing edit the ``package.json`` ``version`` field ( ``0.0.0``-> ``0.0.1`` for example) then push changes... that's all ! -- Publish beta release by setting your version number to `X.Y.Z-beta.T` (example: `1.0.0-beta.32`). You usually want to do that from a branch, - it work as well! You just have to open a PR. +- Publish pre-release by setting your version number to `X.Y.Z-rc.U` (example: `1.0.0-rc.32`). On NPM the version will be tagged `next`. +- The CI runs on `main` and on the branches that have a PR open on `main`. + # Features This template automates the boring and tedious tasks of: