From 56c3c0de8d4d905ba5feec91c502ff05ddfe575b Mon Sep 17 00:00:00 2001 From: Darwin Rinderer Date: Mon, 18 Mar 2024 22:42:44 -0400 Subject: [PATCH] Updating github actions --- .github/workflows/deploy_prod.yaml | 43 +++++++++++++++++++ .../{build.yaml => deploy_staging.yaml} | 3 +- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy_prod.yaml rename .github/workflows/{build.yaml => deploy_staging.yaml} (98%) diff --git a/.github/workflows/deploy_prod.yaml b/.github/workflows/deploy_prod.yaml new file mode 100644 index 0000000..c11d52f --- /dev/null +++ b/.github/workflows/deploy_prod.yaml @@ -0,0 +1,43 @@ +name: Build + +on: + workflow_dispatch: + +jobs: + tests: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - name: Install modules + run: npm install + - name: Run tests + run: npm test + production: + if: ${{ github.event_name == 'workflow_dispatch' && github.ref_name == 'main' }} + env: + environment: production + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: tests + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: '20.x' + - name: Install dependencies + run: npm install + - name: Environment + run: | + echo "Environment: $ENVIRONMENT" + env: + NAME: ${{ env.name }} + ENVIRONMENT: ${{ env.environment }} + - name: Publish + uses: cloudflare/wrangler-action@2.0.0 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + command: publish --env ${{ env.environment }} + env: + CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/deploy_staging.yaml similarity index 98% rename from .github/workflows/build.yaml rename to .github/workflows/deploy_staging.yaml index 3fe9cbd..231b410 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/deploy_staging.yaml @@ -1,4 +1,4 @@ -name: Build +name: Test and Deploy to Staging on: pull_request: @@ -6,7 +6,6 @@ on: - develop push: branches: - - main - develop workflow_dispatch: