Skip to content

Deploy main

Deploy main #224

Workflow file for this run

name: Deploy main
on:
workflow_run:
workflows: ["Build & test"]
branches: [main]
types: [completed]
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'opencast' }}
steps:
- uses: actions/checkout@v5
- name: Prepare gh-pages branch
run: |
git fetch
if git checkout gh-pages; then
# Save CNAME
tmpdir=$(mktemp -d)
cp CNAME $tmpdir || :
# Remove all previous files
git ls-files | while read -r f; do git rm -rf "$f"; done
# Restore CNAME
cp $tmpdir/CNAME . || :
else
git checkout --orphan gh-pages
git ls-files | while read -r f; do rm -f "$f"; git rm --cached "$f"; done
fi
- name: Download artifacts from build workflow
uses: dawidd6/action-download-artifact@v10
with:
name: prod-deployment-files
run_id: ${{ github.event.workflow_run.id }}
- name: Prepare deployment files
run: |
mv .github/.deploy-settings.toml settings.toml
mv build/* .
rmdir build
- name: Commit and push
run: |
git add .
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git commit -m "Deploy ${{ github.event.workflow_run.head_sha }} ($(date))"
git push origin gh-pages