workflow: split into branch-specific pipelines
This commit is contained in:
parent
c6f0411761
commit
73b6671798
2 changed files with 53 additions and 24 deletions
49
.forgejo/workflows/ci-cd-beta.yml
Normal file
49
.forgejo/workflows/ci-cd-beta.yml
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Beta CI/CD Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- beta
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: npm run test
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Upload Build Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
deploy-beta:
|
||||||
|
needs: build-and-test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Build Artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- name: Deploy to Beta via FTP
|
||||||
|
env:
|
||||||
|
FTP_USERNAME: ${{ secrets.BETA_FTP_USERNAME }}
|
||||||
|
FTP_PASSWORD: ${{ secrets.BETA_FTP_PASSWORD }}
|
||||||
|
FTP_HOST: ${{ secrets.FTP_HOST }}
|
||||||
|
run: |
|
||||||
|
lftp -d -u "$FTP_USERNAME","$FTP_PASSWORD" -e "set ssl:verify-certificate no; set ftp:ssl-allow yes; set ftp:ssl-force true; set ftp:ssl-protect-data true; set ftp:passive-mode true; mirror -R dist/ ./; quit" $FTP_HOST
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
name: CI/CD Pipeline
|
name: Production CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
branches:
|
||||||
deployment:
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -30,28 +30,8 @@ jobs:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
|
|
||||||
deploy-beta:
|
|
||||||
needs: build-and-test
|
|
||||||
if: (github.event_name == 'push' && github.ref_name == 'beta') || (github.event_name == 'deployment' && github.event.deployment.environment == 'beta')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Download Build Artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
- name: Deploy to Beta via FTP
|
|
||||||
env:
|
|
||||||
FTP_USERNAME: ${{ secrets.BETA_FTP_USERNAME }}
|
|
||||||
FTP_PASSWORD: ${{ secrets.BETA_FTP_PASSWORD }}
|
|
||||||
FTP_HOST: ${{ secrets.FTP_HOST }}
|
|
||||||
run: |
|
|
||||||
lftp -d -u "$FTP_USERNAME","$FTP_PASSWORD" -e "set ssl:verify-certificate no; set ftp:ssl-allow yes; set ftp:ssl-force true; set ftp:ssl-protect-data true; set ftp:passive-mode true; mirror -R dist/ ./; quit" $FTP_HOST
|
|
||||||
|
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
needs: build-and-test
|
needs: build-and-test
|
||||||
if: (github.event_name == 'push' && github.ref_name == 'main') || (github.event_name == 'deployment' && github.event.deployment.environment == 'production')
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
Loading…
Reference in a new issue