Build and deploy Production #12
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: "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: Set env parameters | |
run: | | |
ver=$(cat .Rprofile | grep hugo.version | cut -d"=" -f2 | sed -e s.\"..g | sed -e s.\ ..g | sed -e s.,..g) | |
echo "hugovr=$ver" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- 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 }} | |