Skip to content

update enable_short_npm_import_path version #168

update enable_short_npm_import_path version

update enable_short_npm_import_path version #168

name: template_initialization
on:
push:
branches:
- main
jobs:
template_initialization:
runs-on: ubuntu-latest
if: ${{ github.event.created && github.repository != 'garronej/ts_ci' }}
steps:
- name: Checking availability for module name ${{github.event.repository.name}} on NPM.
id: id1
uses: garronej/[email protected]
with:
action_name: is_well_formed_and_available_module_name
module_name: ${{github.event.repository.name}}
- name: Checks results
run: |
if [ "$IS_VALID_NODE_MODULE_NAME" = "false" ]; then
echo $MODULE_NAME" is not a valid node module name"
false
fi
if [ "$IS_AVAILABLE_ON_NPM" = "false" ]; then
echo "WARNING: There is already a NPM module named "$MODULE_NAME", if you are not the owner consider picking another name"
fi
true
env:
MODULE_NAME: ${{github.event.repository.name}}
IS_VALID_NODE_MODULE_NAME: ${{steps.id1.outputs.is_valid_node_module_name}}
IS_AVAILABLE_ON_NPM: ${{steps.id1.outputs.is_available_on_npm}}
- uses: actions/checkout@v4
- run: |
mv README.template.md README.md
mv LICENSE.template LICENSE
- name : String replace
id: id2
uses: garronej/[email protected]
with:
action_name: string_replace
input_string: ${{github.event.repository.name}}
search_value: '-'
replace_value: '_'
- name: Replace tokens in README.MD and package.json
uses: cschleiden/replace-tokens@v1
with:
files: '["README.md","package.json","LICENSE","package-lock.json"]'
env:
REPO_NAME: ${{ github.event.repository.name }}
USER_OR_ORG: ${{ github.repository_owner }}
DESC: ${{ github.event.repository.description }}
REPO_NAME_NO_DASHES: ${{ steps.id2.outputs.replace_result }}
- name: Remove this workflow, it only needs to be run once.
run: rm .github/workflows/template_initialization.yaml
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "ts_ci"
git commit -am "Replacing the template's placeholders"
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
branch: main
debug:
runs-on: ubuntu-latest
if: ${{ github.repository == 'garronej/ts_ci' }}
steps:
- name: Show envs
run: env
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJSON(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJSON(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJSON(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: echo "$MATRIX_CONTEXT"