Skip to content

Commit

Permalink
Split test and deploy into 2 workflows for GHA.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Feb 2, 2024
1 parent 7067478 commit f1d2aac
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy

on:
workflow_run:
workflows:
- Test
types:
- completed

jobs:
deploy:
runs-on: ubuntu-22.04

env:
DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }}
DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_NAME }}
DEPLOY_REMOTE: ${{ secrets.DEPLOY_REMOTE }}
DEPLOY_PROCEED: ${{ secrets.DEPLOY_PROCEED }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_SSH_KEY }}
known_hosts: unnecessary
config: |
Host *
StrictHostKeyChecking no
- name: Deploy to Remote
env:
DEPLOY_BRANCH: ${{ env.DEPLOY_BRANCH }}
run: |
REF=${{ github.event.pull_request && github.head_ref || github.ref_name }}
DEPLOY_BRANCH=${DEPLOY_BRANCH:-${REF}} .devtools/deploy.sh
38 changes: 2 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, test and deploy
name: Test

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
- 1.x

jobs:
build:
test:
runs-on: ubuntu-22.04

strategy:
Expand Down Expand Up @@ -86,37 +86,3 @@ jobs:
with:
name: Artifacts (${{ join(matrix.*, ', ') }})
path: build/web/sites/simpletest/browser_output

deploy:
needs:
- build

runs-on: ubuntu-22.04

env:
DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }}
DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_NAME }}
DEPLOY_REMOTE: ${{ secrets.DEPLOY_REMOTE }}
DEPLOY_PROCEED: ${{ secrets.DEPLOY_PROCEED }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_SSH_KEY }}
known_hosts: unnecessary
config: |
Host *
StrictHostKeyChecking no
- name: Deploy to Remote
env:
DEPLOY_BRANCH: ${{ env.DEPLOY_BRANCH }}
run: |
REF=${{ github.event.pull_request && github.head_ref || github.ref_name }}
DEPLOY_BRANCH=${DEPLOY_BRANCH:-${REF}} .devtools/deploy.sh

0 comments on commit f1d2aac

Please sign in to comment.