Merge pull request #1 from phasetida/dev #29
This file contains hidden or 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: Build package and deploy to demo branch | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Set VITE_BASE_PATH env variable | |
| run: echo "VITE_BASE_PATH=/${GITHUB_REPOSITORY#*/}/" >> $GITHUB_ENV | |
| - name: Build static page | |
| run: npm run build | |
| - name: Push pkg to demo branch | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.PUBLISH_TOKEN }} | |
| publish_dir: ./dist | |
| publish_branch: demo | |
| keep_files: false | |
| force_orphan: true | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: demo | |
| path: demo | |
| - name: Checkout target repo | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| repository: phasetida/phasetida_flutter | |
| token: ${{ secrets.FLUTTER_TOKEN }} | |
| path: flutter-package | |
| - name: Copy directory to target repo | |
| run: | | |
| rm -rf flutter-package/assets/phasetida-node-demo | |
| mkdir -p flutter-package/assets/phasetida-node-demo | |
| cp -r demo/* flutter-package/assets/phasetida-node-demo/ | |
| - name: Delete test.json | |
| run: | | |
| rm -f flutter-package/assets/phasetida-node-demo/test.json | |
| - name: Commit and push to target repo | |
| run: | | |
| cd flutter-package | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add assets/ | |
| git commit -m "Sync directory from source repo [skip ci]" || echo "No changes to commit" | |
| git push |