-
Notifications
You must be signed in to change notification settings - Fork 354
chore: add deployment for native hosting #2835
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
base: canary
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Native Hosting | ||
|
|
||
| on: | ||
| push: | ||
| branches: [canary] | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
|
|
||
| jobs: | ||
| build-and-deploy: | ||
| name: Build and Deploy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - uses: pnpm/action-setup@v3 | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Install Catalyst CLI | ||
| run: pnpm add @bigcommerce/catalyst@alpha @opennextjs/cloudflare | ||
| working-directory: core | ||
|
|
||
| - name: Update package scripts | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could see this script being a little finicky if merchants are trying to use this. Might need to think of a better way here, e.g. just running the commands in the Github action.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, I don't think there's much benefit to changing scripts every CI run, since the main benefit behind changing scripts is convenience for developers typing in the commands locally |
||
| run: | | ||
| jq '.scripts.build = "npm run generate && catalyst build --framework catalyst" | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bigcommerce/team-catalyst this is an interesting workaround I had to do. Basically, if the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this change if we move forward with not having the CLI fall back to |
||
| .scripts.dev = "npm run generate && catalyst dev" | | ||
| .scripts.start = "catalyst start" | | ||
| .scripts["deploy"] = "catalyst deploy"' \ | ||
| package.json > package.tmp.json | ||
| mv package.tmp.json package.json | ||
| working-directory: core | ||
|
|
||
| - name: Build Dependencies | ||
| run: pnpm --filter "./packages/*" build | ||
|
|
||
| - name: Catalyst Build | ||
| run: pnpm run build | ||
| working-directory: core | ||
| # These environment variables are required for the build step to succeed | ||
| env: | ||
| AUTH_SECRET: ${{ secrets.NATIVE_HOSTING_AUTH_SECRET }} | ||
| BIGCOMMERCE_CHANNEL_ID: ${{ vars.NATIVE_HOSTING_BIGCOMMERCE_CHANNEL_ID }} | ||
| BIGCOMMERCE_STORE_HASH: ${{ vars.NATIVE_HOSTING_BIGCOMMERCE_STORE_HASH }} | ||
| BIGCOMMERCE_STOREFRONT_TOKEN: ${{ secrets.NATIVE_HOSTING_BIGCOMMERCE_STOREFRONT_TOKEN }} | ||
| BIGCOMMERCE_PROJECT_UUID: ${{ secrets.NATIVE_HOSTING_BIGCOMMERCE_PROJECT_UUID }} | ||
|
|
||
| - name: Catalyst Deploy | ||
| run: | | ||
| pnpm run deploy \ | ||
| --secret BIGCOMMERCE_STORE_HASH=${{ vars.NATIVE_HOSTING_BIGCOMMERCE_STORE_HASH }} \ | ||
| --secret BIGCOMMERCE_STOREFRONT_TOKEN=${{ secrets.NATIVE_HOSTING_BIGCOMMERCE_STOREFRONT_TOKEN }} \ | ||
| --secret BIGCOMMERCE_CHANNEL_ID=${{ vars.NATIVE_HOSTING_BIGCOMMERCE_CHANNEL_ID }} \ | ||
| --secret AUTH_SECRET=${{ secrets.NATIVE_HOSTING_AUTH_SECRET }} | ||
| working-directory: core | ||
| # These environment variables are for the deploy command only | ||
| # Added here to avoid polluting the run script with additional flags | ||
| env: | ||
| BIGCOMMERCE_ACCESS_TOKEN: ${{ secrets.NATIVE_HOSTING_BIGCOMMERCE_ACCESS_TOKEN }} | ||
| BIGCOMMERCE_PROJECT_UUID: ${{ secrets.NATIVE_HOSTING_BIGCOMMERCE_PROJECT_UUID }} | ||
| BIGCOMMERCE_STORE_HASH: ${{ vars.NATIVE_HOSTING_BIGCOMMERCE_STORE_HASH }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is our example gh-action, should we conditionally run this if it's already installed?