B5 Pam: New Picture, New Techstack, Personal Reflections, Future and more #157
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
name: PR Hugo Deploy | |
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request | |
on: | |
pull_request: | |
# types: [labeled] | |
workflow_dispatch: | |
jobs: | |
build: | |
if: ${{ contains( github.event.pull_request.labels.*.name, 'deploy_pr') }} | |
# if: ${{ (github.event.label.name == 'deploy_pr') && (github.repository == 'htw-imi-showtime/showtime-website') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Hugo setup | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: '0.128.0' | |
extended: true | |
- name: Update Config | |
run: | | |
ls config/pull_request | |
cat config/pull_request/config.toml | |
sed -i "s/101/${{ github.event.number }}/g" config/pull_request/config.toml | |
echo "----- updated config: " | |
cat config/pull_request/config.toml | |
- name: Build | |
run: | | |
hugo \ | |
--environment pull_request \ | |
--baseURL "https://htw-imi-showtime.github.io/pull_request/${{ github.event.number }}/" \ | |
--buildDrafts \ | |
--destination hugo_generated_site/public | |
- name: "Upload artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hugo_site | |
path: hugo_generated_site | |
# see https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "pr number" | |
run: | | |
echo ${{ github.event.number }} | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: hugo_site | |
path: hugo_generated_site | |
- name: Push to pull_request repo | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.PULL_REQUEST_DEPLOY_KEY }} | |
with: | |
source-directory: 'hugo_generated_site/public' | |
destination-github-username: 'htw-imi-showtime' | |
destination-repository-name: 'pull_request' | |
user-email: [email protected] | |
target-branch: gh-pages | |
target-directory: ${{ github.event.number }} | |
- name: show url | |
run: | | |
echo "after the pages build and deployment action https://github.com/htw-imi-showtime/pull_request/actions" | |
echo "available at https://htw-imi-showtime.github.io/pull_request/${{ github.event.number }}" | |
# https://cpina.github.io/push-to-another-repository-docs/ | |
# https://github.com/htw-imi-showtime/pull_request |