Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: .github/workflows/api.yml when using wrangler-action passes with vars #2328

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ on:
- 'packages/db/**'
- '.github/workflows/api.yml'
- 'package-lock.json'
workflow_dispatch:
inputs:
force_deploy_staging:
description: whether to deploy to staging even if the job wouldn't normally run
required: true
type: boolean
default: false
force_deploy_production:
description: whether to deploy to production even if the job wouldn't normally run
required: true
type: boolean
default: false

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,7 +65,7 @@ jobs:

deploy-staging:
name: Deploy Staging
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || inputs.force_deploy_staging
runs-on: ubuntu-latest
needs: test
environment:
Expand All @@ -76,6 +89,10 @@ jobs:
apiToken: ${{ secrets.CF_TOKEN }}
workingDirectory: 'packages/api'
environment: 'staging'
vars: |
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START
- name: Test upload to staging
run: |
npm run build -w packages/client
Expand All @@ -84,7 +101,7 @@ jobs:

deploy-production:
name: Deploy Production
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changelog.outputs.releases_created) || inputs.force_release
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changelog.outputs.releases_created) || inputs.force_deploy_production
runs-on: ubuntu-latest
needs:
- test
Expand Down Expand Up @@ -112,3 +129,7 @@ jobs:
apiToken: ${{ secrets.CF_TOKEN }}
workingDirectory: 'packages/api'
environment: 'production'
vars: |
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START
2 changes: 1 addition & 1 deletion packages/api/test/user.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ describe('userLoginPost', function () {
})

it('should not create new users once date is after NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START', async function () {
if ( ! process.env.CI_DONT_ACCOMODATE_LONG_TESTS) {
if (!process.env.CI_DONT_ACCOMODATE_LONG_TESTS) {
// this times out on CI in the default 5 seconds.
// It's not surprising this may take some time, since it relies on creating a whole new miniflare server.
this.timeout(60 * 1000)
Expand Down
Loading