Skip to content

Deploy master

Deploy master #183

Workflow file for this run

name: Deploy master
on:
workflow_run:
workflows: ["Build & test"]
branches: [master]
types: [completed]
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'elan-ev' }}
steps:
- uses: actions/checkout@v4
- name: Prepare gh-pages branch
run: |
git fetch
if git checkout gh-pages; then
# Save CNAME and 404.html
tmpdir=$(mktemp -d)
cp CNAME 404.html $tmpdir || :
# Remove all previous files
git ls-files | while read -r f; do git rm -rf "$f"; done
# Restore 404.html and CNAME
cp $tmpdir/404.html $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: actions/download-artifact@4
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 'noreply@github.com'
git commit -m "Deploy ${{ github.event.workflow_run.head_sha }} ($(date))"
git push origin gh-pages