Merge pull request #1477 from opencast/dependabot/npm_and_yarn/vite-5… #907
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
# This is a basic workflow to help you get started with Actions | |
name: Build & Deploy | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: editor.opencast.org | |
cancel-in-progress: true | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Clean install | |
run: npm ci | |
- name: Build App | |
run: npm run build | |
# tests are currently failing | |
#- run: npm test | |
# env: | |
# CI: true | |
- name: Prepare git | |
run: | | |
git config --global user.name "Editor Deployment Bot" | |
git config --global user.email "[email protected]" | |
- name: Prepare GitHub SSH key | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
install -dm 700 ~/.ssh/ | |
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Clone repository | |
run: | | |
git clone "[email protected]:opencast/opencast-editor.git" ~/editor-clone | |
cd ~/editor-clone | |
git checkout gh-pages | |
- name: Commit new version | |
run: | | |
# store build | |
cp -r build ~/editor-build | |
# save CNAME | |
touch ~/editor-clone/CNAME | |
cp ~/editor-clone/CNAME ~/CNAME | |
# Update gh-pages | |
cd ~/editor-clone | |
git rm -rf . | |
cp ~/CNAME . | |
cp -r ~/editor-build/* . | |
git add ./* | |
git diff --staged --quiet || git commit -m "Build $(date)" | |
- name: Push updates | |
run: | | |
cd ~/editor-clone | |
git push origin gh-pages |