Update UI Files #7
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 UI Files | |
env: | |
SOURCE_REPO: DesignPlain/PlainDashboard | |
USERNAME: ${{ github.actor }} | |
PATH_SOURCE_CHECKOUT: ui_code | |
PATH_TARGET_CHECKOUT: server_code | |
TARGET_FILE: "provider/cmd/pulumi-resource-aws/schema.json" | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [Trigger-UI-File-Update] | |
permissions: write-all | |
jobs: | |
UpdateFiles: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout DesignPlain/PlainDashboard repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.SOURCE_REPO }} | |
path: ${{ env.PATH_SOURCE_CHECKOUT }} | |
- name: Install node and build project | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | |
. ~/.nvm/nvm.sh 2>&1 | |
nvm install node | |
. ~/.nvm/nvm.sh 2>&1 | |
cd $PATH_SOURCE_CHECKOUT | |
npm install | |
npm run build | |
cd .. | |
echo "MergeChanges=true" >> $GITHUB_ENV | |
- name: Checkout DesignPlain/PlainServer repo | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.PATH_TARGET_CHECKOUT }} | |
- name: Copy UI files and commit changes | |
if: env.MergeChanges == 'true' | |
run: | | |
cp -r $PATH_SOURCE_CHECKOUT/dist/design-sphere $PATH_TARGET_CHECKOUT | |
pwd;ls | |
cd $PATH_TARGET_CHECKOUT | |
rm -r ui | |
mv design-sphere ui | |
if [[ $(git diff --name-only|wc -l) -gt 0 ]]; then | |
echo "We do have changes between the UI files, we are committing the changes." | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
git commit -am "Updated UI files" | |
git push -f origin main | |
else | |
echo "We have no changes between UI files, exiting." | |
fi | |
cd .. | |