Update Repository #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Repository | |
# IMPORTANT: Only run on main/master branch. | |
on: | |
workflow_call: | |
secrets: | |
CODELESSLY_PROJECT_CONFIG: | |
required: true | |
CODELESSLY_APP_ACCESS_TOKEN: | |
required: true | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main repo | |
uses: actions/checkout@v4 | |
with: | |
path: main_repo | |
token: ${{ secrets.CODELESSLY_APP_ACCESS_TOKEN }} | |
- name: Install Dart | |
uses: dart-lang/setup-dart@v1 | |
- name: Dart SDK Version | |
run: dart --version | |
- name: Prepare Codelessly Script Runner | |
run: | | |
rm -rf codelessly_script_runner | |
git clone https://github.com/Codelessly/codelessly_script_runner.git --single-branch | |
cd codelessly_script_runner | |
dart pub get | |
- name: Clean main repo | |
run: dart codelessly_script_runner/bin/git_cleaner.dart main_repo | |
- name: Clone Latest Template | |
run: | | |
rm -rf codelessly_starter_brick | |
git clone https://github.com/Codelessly/codelessly_starter_brick.git --single-branch | |
- name: Move template to main repo | |
run: | | |
shopt -s dotglob | |
mv codelessly_starter_brick/__brick__/* main_repo | |
shopt -u dotglob | |
- name: Run script | |
run: dart codelessly_script_runner/bin/main.dart main_repo ${{ secrets.CODELESSLY_PROJECT_CONFIG }} | |
- name: Clean up before commit | |
run: | | |
rm -rf codelessly_script_runner | |
rm -rf codelessly_starter_brick | |
# IMPORTANT: Only works on Unix and needs bash | |
- name: Git Auto Commit | |
uses: stefanzweifel/git-auto-commit-action@v5.0.0 | |
with: | |
commit_message: "Update to latest template" | |
commit_options: '--no-verify --signoff' | |
repository: main_repo | |
commit_user_name: Codelessly Github Actions Bot | |
commit_user_email: codelessly@gmail.com | |
commit_author: Codelessly Actions Bot <codelessly@gmail.com> | |
token: ${{ secrets.CODELESSLY_APP_ACCESS_TOKEN }} | |
- name: Finish | |
run: echo "Finished" |