ts-ci/template_initialization.yaml

65 lines
2.3 KiB
YAML
Raw Normal View History

2021-02-09 20:27:08 +01:00
name: template_initialization
on:
2021-02-26 21:32:19 +01:00
create
2020-11-04 20:00:16 +01:00
2020-05-14 00:47:15 +02:00
jobs:
template_initialization:
runs-on: ubuntu-latest
steps:
- name: Checking availability for module name ${{github.event.repository.name}} on NPM.
id: id1
2021-02-20 11:26:13 +01:00
uses: garronej/github_actions_toolkit@v1.9
2020-05-14 00:47:15 +02:00
with:
action_name: is_well_formed_and_available_module_name
module_name: ${{github.event.repository.name}}
- name: Checks results
run: |
2020-11-04 20:00:16 +01:00
if [ "$IS_VALID_NODE_MODULE_NAME" = "false" ]; then
2020-05-14 00:47:15 +02:00
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@v2
- run: |
mv README.template.md README.md
mv LICENSE.template LICENSE
2020-05-16 06:49:52 +02:00
- name : String replace
id: id2
2021-02-20 11:26:13 +01:00
uses: garronej/github_actions_toolkit@v1.9
2020-05-16 06:49:52 +02:00
with:
action_name: string_replace
input_string: ${{github.event.repository.name}}
search_value: '-'
replace_value: '_'
2020-05-14 00:47:15 +02:00
- name: Replace tokens in README.MD and package.json
uses: cschleiden/replace-tokens@v1
with:
2020-05-17 22:00:20 +02:00
files: '["README.md","package.json","LICENSE","package-lock.json"]'
2020-05-14 00:47:15 +02:00
env:
REPO_NAME: ${{ github.event.repository.name }}
USER_OR_ORG: ${{ github.repository_owner }}
DESC: ${{ github.event.repository.description }}
2020-11-04 19:08:24 +01:00
REPO_NAME_NO_DASHES: ${{ steps.id2.outputs.replace_result }}
2020-05-14 00:47:15 +02:00
- 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 "ts_ci@github.com"
git config --local user.name "ts_ci"
git commit -am "Replacing the template's placeholders"
- name: Push changes
uses: ad-m/github-push-action@v0.5.0
with:
github_token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
2020-08-18 17:11:30 +02:00
branch: develop