v12.4.12 #423
Workflow file for this run
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: Release and Deploy | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the develop branch | |
on: | |
release: | |
types: [released] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: [ 3.8 ] | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get main Google Cloud service account credentials | |
run: | | |
echo $GCP_SA_KEY > client-secret.json | |
env: | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
- name: Get media Google Cloud service account credentials | |
run: | | |
echo $GCP_MEDIA_SERVICE_ACCOUNT_CREDENTIALS > ubyssey-prd-ee6290e6327f.json | |
- name: Get .env file | |
run: | | |
mkdir tmp | |
cd tmp | |
echo $DEPLOYMENT_ENV_VARS > .env | |
cd ../ | |
env: | |
DEPLOYMENT_ENV_VARS: ${{ secrets.DEPLOYMENT_ENV_VARS }} | |
- name: Install Python packages and dependencies | |
run: | | |
pip install -r requirements-prd.txt --use-pep517 | |
pip install requests --upgrade | |
- name: Set up Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 14.x | |
- name: Run gulp to ready frontend static files for production | |
run: | | |
cd ubyssey/static_src | |
npm install -g gulp | |
npm install | |
npm ddp | |
gulp build | |
rm -rf node_modules | |
cd ../../ | |
- name: Collect static files | |
run: | | |
export DJANGO_SETTINGS_MODULE="config.settings.development" | |
python manage.py collectstatic --noinput | |
rm -rf .git/ ubyssey/static_src/ | |
- name: Make final preparations before deployment to Google App Engine | |
run: | | |
rm -rf tmp/ | |
export DJANGO_SETTINGS_MODULE="config.settings.production" | |
pip install -I google-cloud-storage==1.44.0 -t lib/ | |
- id: 'auth' | |
name: Authenticate with Google App Engine | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- id: 'deploy' | |
name: Deploy to Google App Engine | |
uses: google-github-actions/deploy-appengine@v1 | |
with: | |
project_id: ubyssey-prd | |
- id: 'test' | |
name: Test output of deployment | |
run: 'curl "${{ steps.deploy.outputs.url }}"' |