Skip to content

Commit

Permalink
[#68] Deployment (#69)
Browse files Browse the repository at this point in the history
- Adds stub CI workflow
- Adds workflows for deploying to WPVIP develop and production
  • Loading branch information
nick-telsan authored Dec 12, 2023
1 parent c0a8163 commit 2314a67
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
push:
branches: [main, production]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
to-do:
runs-on: ubuntu-latest
steps:
- run: echo "CI goes here"
38 changes: 38 additions & 0 deletions .github/workflows/develop-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Develop Deploy

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.CI_DEPLOY_KEY }}
name: id_goodbids
known_hosts: unnecessary # Actions have have github.com in known_hosts by default
config: |
Host github.com
HostName github.com
IdentityFile /home/runner/.ssh/id_goodbids
if_key_exists: fail

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Push to remote
run: |
git config --unset-all http.https://github.com/.extraheader
git config user.name "GitHub Actions"
git config user.email [email protected]
git remote add wpvip [email protected]:wpcomvip/goodbids.git
git push -f wpvip main:develop
39 changes: 39 additions & 0 deletions .github/workflows/production-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Production Deploy

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [production]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.CI_DEPLOY_KEY }}
name: id_goodbidsNode
known_hosts: unnecessary # Actions have have github.com in known_hosts by default
config: |
Host github.com
HostName github.com
IdentityFile /home/runner/.ssh/id_goodbidsNode
if_key_exists: fail

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: production

- name: Push to remote
run: |
git config --unset-all http.https://github.com/.extraheader
git config user.name "GitHub Actions"
git config user.email [email protected]
git remote add wpvip [email protected]:wpcomvip/goodbids.git
git push -f wpvip production:production

0 comments on commit 2314a67

Please sign in to comment.