Skip to content

Initial commit

Initial commit #1

# GitHub Actions Workflow responsible for template-clean like updating CLA contract url. This workflow is supposed to be triggered automatically
# when a new template-based repository has been created.
name: Template Clean Up
on:
push:
jobs:
# Run cleaning process only if workflow is triggered by the non micronaut-project/micronaut-project-template repository.
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'micronaut-project-template'
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
# Cleanup project
- name: Cleanup
run: |
# Update CLA url in CONTRIBUTING.md
sed -i "s|micronaut-projects/micronaut-project-template|$GITHUB_REPOSITORY|" CONTRIBUTING.md
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" README.md
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" gradle.properties
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" CONTRIBUTING.md
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" MAINTAINING.md
sed -i "s|micronaut-projects/micronaut-project-template|$GITHUB_REPOSITORY|" SECURITY.md
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" project-template/build.gradle
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" project-template-bom/build.gradle
sed -i "s|project-template|${GITHUB_REPOSITORY:29}|" buildSrc/src/main/groovy/io.micronaut.build.internal.project-template-module.gradle
git mv project-template/ "micronaut-${GITHUB_REPOSITORY:29}/"
git mv project-template-bom/ "micronaut-${GITHUB_REPOSITORY:29}-bom/"
git mv buildSrc/src/main/groovy/io.micronaut.build.internal.project-template-module.gradle "buildSrc/src/main/groovy/io.micronaut.build.internal.${GITHUB_REPOSITORY:29}-module.gradle"
git mv buildSrc/src/main/groovy/io.micronaut.build.internal.project-template-base.gradle "buildSrc/src/main/groovy/io.micronaut.build.internal.${GITHUB_REPOSITORY:29}-base.gradle"
# Remove clean up template
rm -rf .github/workflows/template-cleanup.yml
# Commit modified files
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Template cleanup"
# Push changes
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}