Skip to content

Upgrade dependencies, update Makefile #31

Upgrade dependencies, update Makefile

Upgrade dependencies, update Makefile #31

Workflow file for this run

name: Template
on:
push:
branches:
- main
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
if: github.event.repository.name != 'spring-boot-scala-example'
steps:
- name: Fetch Sources
uses: actions/[email protected]
- name: Prepare
run: |
set -ex
export LC_CTYPE=C
export LANG=C
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
ACTOR=$(echo ${GITHUB_ACTOR} | tr '[:upper:]' '[:lower:]')
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:]')
GROUP="com.github.${SAFE_ACTOR}.${SAFE_NAME}"
echo "Using GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
echo "Using GITHUB_ACTOR=${GITHUB_ACTOR}"
echo "Using NAME=${NAME}"
echo "Using GROUP=${GROUP}"
# Replace placeholders in the template-files files
sed -i "s/%NAME%/${NAME}/g" .github/template-files/*
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-files/*
sed -i "s/%GROUP%/${GROUP}/g" .github/template-files/*
# Update package references in sources
find src -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find src -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
# Update K8s deployment files
find deployment -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find deployment -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
find deployment -type f -exec sed -i "s/jecklgamis/${ACTOR}/g" {} +
# Update shell scripts
find . -name "*.sh" -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find . -name "*.sh" -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
find . -name "*.sh" -type f -exec sed -i "s/jecklgamis/${ACTOR}/g" {} +
# Update Makefile
find . -name Makefile -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find . -name Makefile -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
find . -name Makefile -type f -exec sed -i "s/jecklgamis/${ACTOR}/g" {} +
# Update pom.xml
find . -name pom.xml -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find . -name pom.xml -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
find . -name pom.xml -type f -exec sed -i "s/com.jecklgamis/${GROUP}/g" {} +
# Update build.sbt
find . -name build.sbt -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find . -name build.sbt -type f -exec sed -i "s/spring.boot.scala.example/${GROUP}/g" {} +
find . -name build.sbt -type f -exec sed -i "s/com.jecklgamis/${GROUP}/g" {} +
# Update Dockerfile
find . -name Dockerfile -type f -exec sed -i "s/spring-boot-scala-example/${NAME}/g" {} +
find . -name Dockerfile -type f -exec sed -i "s/Jerrico Gamis/FirstName LastName/g" {} +
find . -name Dockerfile -type f -exec sed -i "s/[email protected]/user@some-domain/g" {} +
# Copy content
mkdir -p src/main/scala/${GROUP//.//}
mkdir -p src/test/scala/${GROUP//.//}
cp -R .github/template-files/* .
cp -R src/main/scala/spring/boot/scala/example/* src/main/scala/${GROUP//.//}/
cp -R src/test/scala/spring/boot/scala/example/* src/test/scala/${GROUP//.//}/
# Clean up
rm -rf \
.circleci \
.github/readme \
.github/template-files \
.github/workflows/template.yml \
.idea/icon.png \
src/main/scala/spring \
src/test/scala/spring \
LICENSE
- name: Commit files
run: |
export LC_CTYPE=C
export LANG=C
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -a -m "Prepare repo"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}