Skip to content

Build and deploy Production #501

Build and deploy Production

Build and deploy Production #501

name: "Build and deploy Production"
on:
push:
branches:
- main
schedule:
- cron: "45 */12 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-production
cancel-in-progress: true
jobs:
build:
name: Build site
runs-on: ubuntu-latest
env:
RENV_PROFILE: "production"
RENV_CONFIG_SANDBOX_ENABLED: FALSE
hugobd: public
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set env parameters
run: |
ver=$(cat .hugoversion)
echo "hugovr=$ver" >> $GITHUB_ENV
- name: Install cURL Headers
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.0'
- name: Serup renv
uses: r-lib/actions/setup-renv@v2
- name: Populate untranslated pages
run: |
Rscript scripts/missing_translations.R
- name: Site data - Clean folders
run: rm -r data/directory data/rblogs
- name: Site data - DIRECTORY - Get
uses: actions/checkout@v4
with:
repository: rladies/directory
ssh-key: ${{ secrets.ssh_directoryy_repo }}
path: tmpd/dir
- name: Site data - DIRECTORY - Move
run: |
cp -r tmpd/dir/data/json data/directory
cp -r tmpd/dir/data/img/* assets/directory
- name: Site data - Meetup
uses: actions/checkout@v4
with:
repository: rladies/meetup_archive
ssh-key: ${{ secrets.MEETUP_ARCHIVE_KEY}}
path: tmpd/mtp
- name: Site data - Get blogs list
uses: actions/checkout@v4
with:
repository: rladies/awesome-rladies-blogs
ssh-key: ${{ secrets.RLADIES_BLOGS_KEY}}
path: tmpd/rblogs
- name: Site data - clean cloned repos
run: |
cp -r tmpd/rblogs/blogs data/rblogs
cp -r tmpd/mtp/data/* data/meetup/
rm -rf tmpd
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.hugovr }}
extended: true
- name: Build
run: |
hugo \
-e production \
-d ${{ env.hugobd }}
- name: Deploy production 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ${{ env.hugobd }}