|
| 1 | +# This workflow will run upon repository creation and clean up |
| 2 | +# all files that are not strictly required to build an AEM Live project |
| 3 | +# but that we use to develop the project template. This includes this |
| 4 | +# particular workflow file. |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + workflow_dispatch: |
| 10 | +jobs: |
| 11 | + cleanup: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + actions: write |
| 16 | + # only run if commit message is "Initial commit" on main branch |
| 17 | + if: ${{ github.event_name == 'workflow_dispatch' || ((github.ref == 'refs/heads/main') && (github.event.head_commit.message == 'Initial commit'))}} |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + - name: Use Node.js 20 |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: 20 |
| 25 | + - name: Remove Helper Files |
| 26 | + run: | |
| 27 | + rm -rf \ |
| 28 | + .github/workflows/cleanup-on-create.yaml \ |
| 29 | + CHANGELOG.md |
| 30 | +
|
| 31 | + - name: Remove Form Developement Files |
| 32 | + run: | |
| 33 | + rm -rf \ |
| 34 | + .circleci .npmrc test rollup playwright.config.js |
| 35 | +
|
| 36 | + - name: Update .eslintignore |
| 37 | + run: | |
| 38 | + sed -i '/^rollup/d' .eslintignore |
| 39 | + sed -i '/^helix-importer-ui/d' .eslintignore |
| 40 | +
|
| 41 | + - name: Update Package.json |
| 42 | + run: | |
| 43 | + rm -rf package.json package-lock.json |
| 44 | + mv package-prod.json package.json |
| 45 | + mv package-prod-lock.json package-lock.json |
| 46 | +
|
| 47 | + - name: Initialize README |
| 48 | + # replace {repo} and {owner} with the actual values |
| 49 | + run: | |
| 50 | + sed -i.bak "s/{repo}/$(basename ${{ github.repository }})/g" README.md |
| 51 | + sed -i.bak "s/{owner}/$(dirname ${{ github.repository }})/g" README.md |
| 52 | + - name: Initialize Pull Request Template |
| 53 | + run: | |
| 54 | + sed -i.bak "s/aem-boilerplate-forms/$(basename ${{ github.repository }})/g" .github/pull_request_template.md |
| 55 | + sed -i.bak "s/adobe-rnd/$(dirname ${{ github.repository }})/g" .github/pull_request_template.md |
| 56 | +
|
| 57 | + # commit back to the repository |
| 58 | + - name: Commit changes |
| 59 | + run: | |
| 60 | + git config --local user.email "[email protected]" |
| 61 | + git config --local user.name "AEM Bot" |
| 62 | + git add . |
| 63 | + git commit -m "chore: cleanup repository template" |
| 64 | + git push |
0 commit comments