small link fix #180
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: Deploy Web Previews | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- preview-** | |
workflow_call: | |
inputs: | |
branch: | |
required: true | |
type: string | |
jobs: | |
Deploy-Web-Preview: | |
if: ${{ github.repository_owner == 'osg-htc' }} | |
runs-on: ubuntu-latest | |
env: | |
preview_url: https://github.com/osg-htc/web-preview.git | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
ref: ${{ inputs.branch }} | |
- name: Get branch name | |
run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
bundler-cache: true | |
- name: Configure for Dev Preview | |
run: | | |
rm CNAME -f | |
sed -i "s|baseurl: ''|baseurl: '/web-preview/${{ env.BRANCH_NAME }}'|" _config.yml | |
git config user.name "Automatic preview publish" | |
git config user.email "[email protected]" | |
git commit -am "GHA: path-cc/path-cc.github.io #$GITHUB_RUN_NUMBER" | |
- name: Setup SSH Keys and known_hosts | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.WEB_PREVIEW_DEPLOY_KEY }} | |
- name: Build and Deploy | |
run: | | |
git checkout -b temp-branch | |
bundle exec jekyll build | |
mkdir temp-dir | |
mv _site ${{ env.BRANCH_NAME }} | |
mv ${{ env.BRANCH_NAME }} temp-dir | |
git add temp-dir | |
git commit -m "Build Branch Website" | |
SPLIT_BRANCH=$(git subtree split --prefix temp-dir temp-branch) | |
git remote add web-preview ${{ env.preview_url }} | |
git fetch --all | |
git checkout -b preview web-preview/main | |
git merge $SPLIT_BRANCH -m "Merge Split Branch" --allow-unrelated-histories -X theirs | |
git push web-preview HEAD:main | |
- name: Print the preview url | |
run: | | |
echo "Your Preview URL: https://opensciencegrid.org/web-preview/${{ env.BRANCH_NAME }}/" |