Create CNAME #1
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: Deploy Site | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
set-deploy-type: | |
runs-on: ubuntu-latest | |
outputs: | |
target: ${{ steps.set-output.outputs.target }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: get deployment target | |
run: | | |
TARGET=$(cat DEPLOY_STRATEGY) | |
echo "TARGET=$TARGET" >> $GITHUB_ENV | |
- name: check if target is valid | |
if: success() && !contains(fromJSON('["gh-pages", "firebase", "none"]'), env.TARGET) | |
run: echo 'Invalid Deployment Target' && exit 1 | |
# gh actions doesn't support using the 'env' context on job level ifs for | |
# some reason smh. here we use outputs instead | |
- name: set output to deploy target | |
id: set-output | |
run: echo "::set-output name=target::${{ env.TARGET }}" | |
# not sure if anyone wants this but I'm putting this here for those that don't | |
# want to host their site. else the actions will show an annoying x whenever | |
# you push to master | |
deploy-none: | |
runs-on: ubuntu-latest | |
needs: set-deploy-type | |
if: needs.set-deploy-type.outputs.target == 'none' | |
steps: | |
- run: echo 'No Deployment Specified' && exit 0 | |
deploy-gh-pages: | |
runs-on: ubuntu-latest | |
needs: set-deploy-type | |
if: needs.set-deploy-type.outputs.target == 'gh-pages' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Deploy Jekyll Site | |
uses: sujaykundu777/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} | |
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} | |
deploy-firebase: | |
runs-on: ubuntu-latest | |
needs: set-deploy-type | |
if: needs.set-deploy-type.outputs.target == 'firebase' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: build jekyll | |
run: | | |
bundle install | |
bundle exec jekyll build | |
- name: deploy to firebase | |
uses: w9jds/firebase-action@master | |
with: | |
args: deploy --only hosting | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} |