Skip to content

Commit

Permalink
Adapted clean up workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Oct 16, 2023
1 parent 7d9fd77 commit c368c67
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/template-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'bundle-template'
permissions:
contents: write
steps:

# Check out current repository
Expand All @@ -27,7 +29,7 @@ jobs:
- name: Get bundle generator
uses: actions/checkout@v2
with:
token: ${{ secrets.EZROBOT_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
repository: ibexa/bundle-generator
path: .generator

Expand All @@ -37,32 +39,28 @@ jobs:
php composer-setup.php
php composer.phar install -d .generator
- name: "Apply repository labels"
uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Cleanup project
- name: Cleanup
run: |
export LC_CTYPE=C
export LANG=C
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]')
ACTOR=$(echo $GITHUB_ACTOR)
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
VENDOR_NAME=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
VENDOR_NAMESPACE=$(echo $ACTOR | sed 's/\<./\U&/g' | sed 's/[^a-zA-Z0-9]//g')
# Converts repository name to UpperCamelCase (if separated by "-")
_temp=(${NAME//-/ })
CC_NAME=$(printf %s "${_temp[@]^}")
BUNDLE_NAME=$(printf %s "${_temp[@]^}")
# Remove lines marked with #REMOVE-ON-CLEANUP#
find . -type f -exec sed -i '/#REMOVE-ON-CLEANUP#/d' {} +
# Run generator
echo Running generator with: php .generator/bin/ibexa-bundle-generator $SAFE_NAME $SAFE_NAME-dir --vendor-name=ibexa --vendor-namespace=Ibexa --bundle-name=$CC_NAME --skeleton-name=ibexa-ee
php .generator/bin/ibexa-bundle-generator $SAFE_NAME $SAFE_NAME-dir --vendor-name=ibexa --vendor-namespace=Ibexa --bundle-name=$CC_NAME --skeleton-name=ibexa-ee
echo Running generator with: php .generator/bin/ibexa-bundle-generator $SAFE_NAME $SAFE_NAME-dir --vendor-name=ibexa --vendor-namespace=$VENDOR_NAMESPACE --bundle-name=$BUNDLE_NAME --skeleton-name=extension
php .generator/bin/ibexa-bundle-generator $SAFE_NAME $SAFE_NAME-dir --vendor-name=$SAFE_ACTOR --vendor-namespace=$VENDOR_NAMESPACE --bundle-name=$BUNDLE_NAME --skeleton-name=extension
# Move content
cp -R $SAFE_NAME-dir/* .
Expand Down

0 comments on commit c368c67

Please sign in to comment.