Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create build-prod.yaml #1

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/build-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Name our workflow
name: Production Deployment

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "prod" branch
push:
branches: [ prod ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Add production environment protection
environment: production

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Set up SSH authentication using our private key
- name: Install SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.PROD_SSH_KEY }}

# Add our server to known_hosts to prevent SSH security prompts
- name: Add Known Hosts
run: ssh-keyscan -H ${{ secrets.PROD_SERVER_IP }} >> ~/.ssh/known_hosts

# Connect to our server and run the update script
- name: Deploy
run: |
ssh ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_IP }} '${{ secrets.PROD_DEPLOY_COMMAND }}'
Loading