Skip to content

Merge pull request #95 from Climate-Refugee-Stories/cms/stories/Navaj… #128

Merge pull request #95 from Climate-Refugee-Stories/cms/stories/Navaj…

Merge pull request #95 from Climate-Refugee-Stories/cms/stories/Navaj… #128

Workflow file for this run

---
name: Deploy Website
on:
push:
branches:
- master
paths-ignore:
- ".github/**"
- ".git*"
- "README.md"
workflow_dispatch:
jobs:
prod_prep:
name: Actions creating the Archive data file (archive_data.json)
runs-on: ubuntu-latest
container:
image: docker.io/python:3-slim
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install pipenv
run: pip install pipenv
- uses: actions/setup-python@v3
with:
python-version: "3.x"
cache: "pipenv"
- name: installing pipenv packages
run: cd .github/repo_ci-cd/deployment/ && pipenv sync
- name: Update Archive data
run: cd .github/repo_ci-cd/deployment/ && pipenv run ./csv_to_json.py > "${GITHUB_WORKSPACE}/data/archive_data.json"
- name: uploading archive data
uses: actions/upload-artifact@v3
with:
name: archive-data
path: data/
prod:
name: Deploy to prod
runs-on: ubuntu-latest
needs: prod_prep
container:
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
steps:
- name: Prep env
run: |
set -ex
apk add --update --no-cache openssl git bash &&
rm -rf /var/cache/apk/*
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
- name: downloading archive data
uses: actions/download-artifact@v3
with:
name: archive-data
path: data/
- name: Deploy to Github Pages
run: bash .github/repo_ci-cd/deployment/deploy.sh
env:
GITHUBTOKEN: ${{ secrets.GITHUB_TOKEN }}
ARGZ: --gc --minify --cleanDestinationDir
GH_PAGES: gh-pages
#DEBUG: 'true'
# uses: chabad360/hugo-gh-pages@v2
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# env:
# HUGO_ARGS: --gc --minify --cleanDestinationDir
# CNAME: <domain>
- name: uploading algolia data
uses: actions/upload-artifact@v3
with:
name: algolia-data
path: /tmp/gh-pages/algolia.json
auto_actions:
name: Actions to update Algolia after site's been deployed
runs-on: ubuntu-latest
needs: prod
# https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#using-an-environment
environment: production
container:
image: docker.io/python:3-slim
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install pipenv
run: pip install pipenv
- uses: actions/setup-python@v3
with:
python-version: "3.x"
cache: "pipenv"
- name: installing pipenv packages
run: cd .github/repo_ci-cd/deployment/ && pipenv sync
- name: downloading algolia data
uses: actions/download-artifact@v3
with:
name: algolia-data
- name: Update Algolia index
run: cd .github/repo_ci-cd/deployment/ && pipenv run ./algolia.py
# https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}