Skip to content

Commit

Permalink
add production deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
yelper committed Feb 9, 2020
1 parent 4ad844c commit 1280b5d
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## Author: Alper Sarikaya
## Last modified: 2020-02-09 🎂
## This script should be run only when a released is published *for the current year*.
##
## This action will build the entire site from scratch, taking ALL commits from *other*
## branches as production-ready, and only checking out the current year's branch up to
## the tagged release SHA.
##
## NOTE: only create releases on the latest branch (currently: vis2020).
## e.g., `git checkout {sha}`, `git tag -a v2020.1.1 -m "v2020.1.1"`,
## `git push --tags`, and then create a release in GitHub from that tag.
##
##
## This script is based on staging.yml. The only differences:
## * the triggers are published releases, not any push to the repository
## * the initial checkout also gets available tags
## * the `release` event's tag is used to check out the current branch
## (disregarding any commits made after the release was created)
## * the script deploys to production instead of staging

## TODO: note last step still deploys to staging; currently verifying script works...

name: deploy production on release

on:
release:
# deploy production whenever someone publishes a release on the current year's branch.
types:
- published

jobs:
build:
runs-on: ubuntu-latest

steps:
## SET UP STEPS
- uses: actions/checkout@v2
- name: Get all branches+tags and checkout master
run: |
git fetch --tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git checkout master
- name: Set up Python 2.7.x
uses: actions/setup-python@v1
with:
python-version: '2.x'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Install Ruby 2.6.x
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6.x'
- name: Install ruby dependencies
run: |
gem install bundler
gem install jekyll
- name: Set up AWS credentials (+ set default user)
run: |
mkdir -p ~/.aws
touch ~/.aws/credentials
echo "[default]
aws_access_key_id = ${{ secrets.aws_deploy_key_id }}
aws_secret_access_key = ${{ secrets.aws_secret_access_key }}" > ~/.aws/credentials
## SET IEEEVIS_AWS_USER environment variable to "default" in deploy step

## BUILD ARCHIVE YEARS (2018 and before)
- name: Build archive years
run: make site

## BUILD LAST YEAR (currently: vis2019)
- name: Build last year (2019)
run: |
git checkout vis2019
make new2019
## BUILD THIS YEAR (currently: vis2020)
## ./scripts/fix_file_extensions.sh moves some evergreen content from current year
## ∟ also only check out the tag linked to the triggering event
- name: Build this year (2020) + deploy
env:
IEEEVIS_AWS_USER: default
run: |
git checkout ${{ github.event.release.tag_name }}
make staging2020

0 comments on commit 1280b5d

Please sign in to comment.