-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:gerritbehrens/showtime-website
- Loading branch information
Showing
53 changed files
with
485 additions
and
142 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build Hugo and Check Title | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
hugo-build: | ||
if: github.repository == 'htw-imi-showtime/showtime-website' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: false | ||
- name: Get Theme | ||
run: | | ||
git submodule update --init themes/showtime-theme-2021 | ||
- name: Hugo setup | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: '0.128.0' | ||
extended: true | ||
|
||
- name: Build | ||
run: | | ||
hugo \ | ||
--environment staging \ | ||
--baseURL "https://htw-imi-showtime.github.io/tryout/" \ | ||
--buildDrafts | ||
check-title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: false | ||
fetch-depth: 1 | ||
- name: check pr title starts with project id or "STW" | ||
id: extract_pid | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
run: | | ||
./bin/check-project-update-pr/check-title.sh "$PR_TITLE" | ||
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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: Get Theme | ||
run: | | ||
git submodule update --init themes/showtime-theme-2021 | ||
- 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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ node_modules/ | |
.linkinator/ | ||
hugo-temp/ | ||
tmp/ | ||
files-other.txt | ||
files-project.txt |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# the gh action will access the gh api to ask for changed files | ||
# note that this only works if your main is up-to-date with origin/main | ||
shopt -s nocaseglob | ||
|
||
diff_main=$(git diff --name-only main) | ||
files_in_pr="" | ||
for f in $diff_main; do | ||
# echo $f | ||
dir_name=$(dirname $f) | ||
base_name=$(basename $f) | ||
found_file=$(find $dir_name -maxdepth 1 -name $base_name) | ||
# echo "found file: ##$found_file##" | ||
if test -n "$found_file" | ||
then | ||
files_in_pr="$files_in_pr $f" | ||
fi | ||
done | ||
|
||
echo $files_in_pr | tr ' ' '\n' |
Oops, something went wrong.