Skip to content

Instantly share code, notes, and snippets.

@nathan-roberts
Created July 14, 2023 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathan-roberts/013b3b184a52c4d05bf7864117c31436 to your computer and use it in GitHub Desktop.
Save nathan-roberts/013b3b184a52c4d05bf7864117c31436 to your computer and use it in GitHub Desktop.
Build SASS and Deploy via SSH
name: SCSS Build and Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 12
- name: Install dependencies
run: |
npm install
working-directory: ./wp-content/themes/test-theme
- name: Build project
run: |
npm run build
working-directory: ./wp-content/themes/test-theme
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: ./ # Change this path based on where the build output is located
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: dist
- name: rsync deployments
uses: burnett01/rsync-deployments@6.0.0
with:
switches: -avzr --delete
path: ./ # Ensure this path corresponds to the location of the downloaded artifact
remote_path: ${{ secrets.SSH_REMOTE_PATH }}
remote_host: ${{ secrets.SSH_SERVER }}
remote_user: ${{ secrets.SSH_USER }}
remote_key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"text": "Project Deployed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Deployment Complete:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: {{SLACK_WEBHOOK_URL}}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment