Skip to content

Merge pull request #46 from Yamasaki-pan961/main #32

Merge pull request #46 from Yamasaki-pan961/main

Merge pull request #46 from Yamasaki-pan961/main #32

name: Template Cleanup
on:
push:
branches:
- main
jobs:
template-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
timeout-minutes: 10
if: github.event.repository.name != 'flutter-training-template'
steps:
- name: Fetch sources
uses: actions/checkout@v3
- name: Create issues from sessions
uses: ./.github/actions/create-issues-from-sessions
# TODO: After adding a challenge, uncomment.
# - name: Create issues from challenges
# uses: ./.github/actions/create-issues-from-challenges
- name: Cleanup
shell: bash
run: |
# Make tmp dir and move work dir to tmp
mkdir "tmp" && cd tmp || exit
# Install fvm
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew tap leoafarias/fvm
brew install fvm
# Install & Setup Flutter
flutterLatestVersion=$(fvm releases | grep -o -E "v?[0-9]+\.[0-9]+\.[0-9]+\s+stable" | sed -e "s/[ ]*stable//g")
fvm install "$flutterLatestVersion"
fvm use "$flutterLatestVersion" --force
# Create Flutter Project
fvm flutter create \
-t app \
--empty \
-i swift \
-a kotlin \
--platforms ios,android \
--org jp.co.yumemi \
--project-name flutter_training \
.
# Add lints to dev_dependencies
fvm flutter pub add blendthink_lints --dev
fvm flutter pub remove flutter_lints
# Move work dir to project root
cd ..
# Copy templates
cp -R .github/templates/. tmp
# Delete anything except tmp dir
rm -rf \
.github \
docs \
packages \
.gitignore \
LICENSE \
README.md
# Move new training project to project root
mv -f tmp/* tmp/.[^\.]* ./ && rm -rf tmp
- 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"
- name: Push changes
uses: ad-m/[email protected]
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}