Skip to content

Commit

Permalink
Merge pull request #11 from ivoa/iss10
Browse files Browse the repository at this point in the history
Upload the branch version of the website for pull requests
  • Loading branch information
JeremyMcCormick authored May 19, 2024
2 parents b467cd4 + ebe4427 commit 64a705a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 39 deletions.
23 changes: 23 additions & 0 deletions .github/actions/setup-hugo/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Download and extract Hugo'
description: 'Downloads and extracts a specified version of Hugo'
inputs:
hugo_version:
description: 'Version of Hugo to download'
required: false
default: '0.123.4'
runs:
using: 'composite'
steps:
- name: Cache Hugo
uses: actions/cache@v2
with:
path: ~/hugo
key: ${{ runner.os }}-hugo-${{ inputs.hugo_version }}
- name: Download and extract Hugo
run: |
if [ ! -f ~/hugo ]; then
wget https://github.com/gohugoio/hugo/releases/download/v${{ inputs.hugo_version }}/hugo_${{ inputs.hugo_version }}_Linux-64bit.tar.gz
tar -zxvf hugo_${{ inputs.hugo_version }}_Linux-64bit.tar.gz
mv hugo ~/hugo
fi
shell: bash
39 changes: 0 additions & 39 deletions .github/workflows/build_and_deploy.yaml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/deploy_main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Deploy the main version of the website"

on:
workflow_dispatch:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Hugo
uses: ./.github/actions/setup-hugo

- name: Build the website
run: ~/hugo

- name: Deploy the website
uses: Dylan700/sftp-upload-action@latest
with:
username: webstage
server: web.ivoa.net
key: ${{ secrets.STAGE_ID }}
uploads: |
./public/ => ./ivoa-web-stage/
34 changes: 34 additions & 0 deletions .github/workflows/deploy_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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: echo "BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/\//-/g')" >> $GITHUB_ENV

- name: Debug 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
key: ${{ secrets.STAGE_ID }}
uploads: |
./public/ => ./ivoa-web-stage/v/${{ env.BRANCH_NAME }}

0 comments on commit 64a705a

Please sign in to comment.