diff --git a/.forgejo/workflows/ci-cd-beta.yml b/.forgejo/workflows/ci-cd-beta.yml new file mode 100644 index 0000000..ab6f2ee --- /dev/null +++ b/.forgejo/workflows/ci-cd-beta.yml @@ -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 diff --git a/.forgejo/workflows/ci-cd.yml b/.forgejo/workflows/ci-cd-main.yml similarity index 51% rename from .forgejo/workflows/ci-cd.yml rename to .forgejo/workflows/ci-cd-main.yml index df70beb..6f92c52 100644 --- a/.forgejo/workflows/ci-cd.yml +++ b/.forgejo/workflows/ci-cd-main.yml @@ -1,16 +1,16 @@ -name: CI/CD Pipeline +name: Production CI/CD Pipeline on: push: - pull_request: - deployment: + branches: + - main jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Install dependencies run: npm ci @@ -30,28 +30,8 @@ jobs: name: 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: 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 environment: name: production