github pages #51
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: github pages | |
on: | |
push: | |
branches: | |
- main # Set a branch to deploy | |
- develop # Note has logic around deployment | |
schedule: | |
- cron: 0 13 * * 1 # At 13:00 on Monday | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Install curl | |
run: sudo apt update && sudo apt-get install -y libcurl4-openssl-dev | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.2.0' | |
- name: Setup renv | |
uses: r-lib/actions/setup-renv@v2 | |
with: | |
cache-version: 2 | |
- name: Run scripts | |
run: | | |
Rscript scripts/add_badges.R | |
Rscript scripts/add_contributions.R | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run visualisations | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
Rscript scripts/add_hexwall_network.R | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.85.0' | |
extended: true | |
# IF main | |
- name: Build | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: hugo --minify | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
# IF develop | |
- name: Build | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: hugo -e staging | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Deploy static site to S3 bucket | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: aws s3 sync ./public/ s3://openpharma/develop --delete |