Fork test #89
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 a branch version of the website" | |
on: | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: | | |
if [ "${{ github.event.pull_request.head.repo.fork }}" = "true" ]; then | |
FORK_NAME="${{ github.event.pull_request.head.repo.full_name }}" | |
BRANCH_NAME="${FORK_NAME}/$(echo ${{ github.head_ref }})" | |
else | |
BRANCH_NAME=$(echo ${{ github.head_ref }}) | |
fi | |
BRANCH_NAME=$(echo $BRANCH_NAME | sed 's/\//-/g') | |
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | |
- name: Print branch name | |
shell: bash | |
run: echo "BRANCH_NAME=${{ env.BRANCH_NAME }}" | |
- name: Setup Hugo | |
uses: ./.github/actions/setup-hugo | |
- name: Build the website | |
run: ~/hugo -b https://webtest.ivoa.info/v/${{ env.BRANCH_NAME }} | |
- name: Upload the branch version of the website | |
uses: Dylan700/sftp-upload-action@latest | |
with: | |
username: webstage | |
server: web.ivoa.net | |
port: ${{ secrets.SFTP_PORT }} | |
key: ${{ secrets.STAGE_ID }} | |
uploads: | | |
./public/ => ./ivoa-web-stage/v/${{ env.BRANCH_NAME }} |