mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-28 08:49:42 +02:00
ci(workflows): add release and deployment automation
This commit is contained in:
parent
3babb5ced6
commit
0e9432b5ff
7 changed files with 117 additions and 7 deletions
62
.github/workflows/release-deployment.yml
vendored
Normal file
62
.github/workflows/release-deployment.yml
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
name: Deploy to Vercel Production
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install Vercel CLI
|
||||
run: npm install --global vercel@latest
|
||||
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=production --token=$VERCEL_TOKEN
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Build Project Artifacts
|
||||
run: vercel build --prod --token=$VERCEL_TOKEN
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Deploy to Vercel Production
|
||||
run: |
|
||||
DEPLOYMENT_URL=$(vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN)
|
||||
echo "Deployed to: $DEPLOYMENT_URL"
|
||||
echo "deployment_url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
|
||||
id: deploy
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
|
||||
- name: Comment on Release
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const deployment_url = '${{ steps.deploy.outputs.deployment_url }}';
|
||||
const { owner, repo } = context.repo;
|
||||
const release_id = context.payload.release.id;
|
||||
|
||||
await github.rest.repos.updateRelease({
|
||||
owner,
|
||||
repo,
|
||||
release_id,
|
||||
body: context.payload.release.body +
|
||||
'\n\n---\n🚀 **Deployed to Production:** ' + deployment_url
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue