Skip to content

Design event post

Design event post #19

Workflow file for this run

name: Deploy PR previews
concurrency: preview-${{ github.event.pull_request.head.sha }}
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Clone PR
uses: actions/checkout@v3
with:
submodules: true
ref: refs/pull/${{ github.event.pull_request.number }}/merge
path: site
# install Hugo
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
# build website
- name: Build
run: |
cd site
sed -i '1 s/osac.org.np/betadeploy.osac.org.np\/${{github.event.pull_request.number}}/' config.toml
cat config.toml | head -n 1
hugo --minify
# checkout to the betadeploy repository to host pr previews
- name: Clone betadeploy
uses: actions/checkout@v3
with:
repository: 'osac/betadeploy'
path: betadeploy
token: ${{secrets.MACHINE_USER_TOKEN}}
ref: gh-pages
- name: Custom files
run: |
echo "betadeploy.osac.org.np" > ./betadeploy/CNAME
echo "" > ./betadeploy/.nojekyll
rm -rf ./betadeploy/${{github.event.pull_request.number}}
mv site/public ./betadeploy/${{github.event.pull_request.number}}
- name: Commit and push
run: |
cd betadeploy
git add .
git config --global user.name 'ssn212'
git config --global user.email '[email protected]'
git commit -m "deploy: ${{ github.event.pull_request.head.sha }} "
git push
- name: Sleep to make sure page gets updated
run: sleep 10s
shell: bash
- name: comment Preview Ready
if: ${{ success() }}
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
### ✅ Deploy Preview for OSAC ready! [CLICK HERE TO VIEW](https://betadeploy.osac.org.np/${{ github.event.pull_request.number }})
Site Link: https://betadeploy.osac.org.np/${{ github.event.pull_request.number }}
| Name | Link |
|-|-|
| 🔨 Latest commit | ${{ github.event.pull_request.head.sha }} |
| 🔍 Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
- if: ${{ failure() }}
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
### ❌ Deploy Preview for OSAC failed.
| Name | Link |
|-|-|
| 🔨 Latest commit | ${{ github.event.pull_request.head.sha }} |
| 🔍 Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |