-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace CD workflow with staging and production deployments
This will continiously deploy the main branch to staging as before. Rather than merging to production , production deployments will now be performed on release.
- Loading branch information
Showing
5 changed files
with
82 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Deploy to production | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
production: | ||
uses: dracor-org/einakter/.github/workflows/deployment.yml@main | ||
with: | ||
host: dracor.org | ||
deploy-path: /var/www/einakter | ||
secrets: | ||
deploy-key: ${{ secrets.DRACOR_ORG_DEPLOY_KEY }} | ||
deploy-user: ${{ secrets.DRACOR_ORG_DEPLOY_USER }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Deploy to staging | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
staging: | ||
uses: dracor-org/einakter/.github/workflows/deployment.yml@main | ||
with: | ||
host: staging.dracor.org | ||
deploy-path: /var/www/einakter | ||
secrets: | ||
deploy-key: ${{ secrets.DRACOR_ORG_DEPLOY_KEY }} | ||
deploy-user: ${{ secrets.DRACOR_ORG_DEPLOY_USER }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Deployment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
host: | ||
required: true | ||
type: string | ||
deploy-path: | ||
required: true | ||
type: string | ||
secrets: | ||
deploy-key: | ||
required: true | ||
deploy-user: | ||
required: true | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: "20.x" | ||
- name: Restore node_modules | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} | ||
|
||
- run: yarn install | ||
- run: yarn test --watch=false | ||
- run: yarn build | ||
|
||
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 | ||
with: | ||
ssh-private-key: ${{ secrets.deploy-key }} | ||
|
||
- name: Deploy to ${{ inputs.host }} | ||
run: | | ||
rsync -rlvz --delete \ | ||
--exclude=robots.txt \ | ||
--exclude=google*.html \ | ||
-e 'ssh -o StrictHostKeyChecking=no' \ | ||
build/ \ | ||
${{ secrets.deploy-user }}@${{ inputs.host }}:${{ inputs.deploy-path }}/ |