trying to make the github action script work for stage and prod branches
This commit is contained in:
parent
da3ee60ea3
commit
a6a79f30e4
1 changed files with 10 additions and 9 deletions
15
.github/workflows/build-and-deploy.yml
vendored
15
.github/workflows/build-and-deploy.yml
vendored
|
|
@ -3,16 +3,18 @@ name: Build Astro and deploy dist
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- stage # or your default branch
|
- stage
|
||||||
|
- prod
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # 👈 This is required for pushing branches
|
contents: write # 👈 This is required for pushing branches
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: stage
|
# Dynamically set environment name based on branch
|
||||||
|
environment: ${{ github.ref_name }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|
@ -21,7 +23,7 @@ jobs:
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22' # match your project
|
node-version: "22" # match your project
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -29,7 +31,7 @@ jobs:
|
||||||
- name: Build Astro project
|
- name: Build Astro project
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Deploy dist to dist-stage
|
- name: Deploy dist to dist-${{ env.DIST_BRANCH }}
|
||||||
run: |
|
run: |
|
||||||
# Configure Git
|
# Configure Git
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
|
|
@ -46,7 +48,7 @@ jobs:
|
||||||
|
|
||||||
git branch
|
git branch
|
||||||
git commit -m "Update dist/ [skip ci]"
|
git commit -m "Update dist/ [skip ci]"
|
||||||
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/Signum/workaround-astro-starlight.git temp-build:dist-stage --force
|
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} temp-build:${{ env.DIST_BRANCH }} --force
|
||||||
|
|
||||||
- name: Trigger deployment webhook
|
- name: Trigger deployment webhook
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -54,4 +56,3 @@ jobs:
|
||||||
env:
|
env:
|
||||||
DEPLOY_WEBHOOK: ${{ secrets.COOLIFY_DEPLOY_WEBHOOK }}
|
DEPLOY_WEBHOOK: ${{ secrets.COOLIFY_DEPLOY_WEBHOOK }}
|
||||||
DEPLOY_TOKEN: ${{ secrets.COOLIFY_DEPLOY_TOKEN }}
|
DEPLOY_TOKEN: ${{ secrets.COOLIFY_DEPLOY_TOKEN }}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue