Skip to content

Merge pull request #6 from Chao-Ma5566/feat-add-github-action #3

Merge pull request #6 from Chao-Ma5566/feat-add-github-action

Merge pull request #6 from Chao-Ma5566/feat-add-github-action #3

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Deploy to Render
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Deploy to Render
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
run: |
curl -X POST \
-H "Authorization: Bearer $RENDER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"serviceId": "srv-cpoos62j1k6c73ac1420"}' \
https://api.render.com/v1/services/YOUR_RENDER_SERVICE_ID/deploys
- name: Create Deployment Status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"state": "success", "target_url": "https://api.render.com/v1/services/YOUR_RENDER_SERVICE_ID/deploys", "description": "Deployment to Render successful", "context": "continuous-integration/render"}' \
https://api.github.com/repos/OWNER/REPO/statuses/COMMIT_SHA
- name: Notify deployment status
if: success()
run: echo "Deployment to Render successful!"