-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 90e844b
Showing
20 changed files
with
7,290 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy Example Website | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
inputs: | ||
pages-branch: | ||
description: | | ||
Which Pages branch to deploy to. | ||
Set this to the default branch (usually `main`) if you want to deploy to production. | ||
And `preview` for anything else' | ||
required: true | ||
type: choice | ||
default: 'main' | ||
options: | ||
- 'main' | ||
- 'preview' | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy | ||
uses: ./ | ||
# uses: trufflehq/pages-turbo-workspace-action@v1 | ||
with: | ||
# The script to build your site (joins with `yarn workspace $workspace_name`) (default: `build`) | ||
build_script: build | ||
# Cloudflare Account ID | ||
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
# Cloudflare API Token | ||
cloudflare_api_token: ${{ secrets.CLOUDFLARE_PAGES_API_KEY }} | ||
# The directory of static assets to upload (default: `dist`) | ||
directory: dist | ||
# GitHub Token | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# Optional: The script to run before building your site | ||
prebuild_script: yarn build | ||
# Optional: The branch to deploy to production | ||
production_branch: ${{ github.event.repository.default_branch }} | ||
# The name of the Cloudflare Pages project | ||
project_name: ptw-example | ||
# The name of the yarn workspace being deployed | ||
workspace_name: web | ||
# The branch to deploy to in the cloudflare project | ||
deploy-to-branch: ${{ github.event.inputs.pages-branch || github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.turbo | ||
.envrc | ||
.yarn/install-state.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"recommendations": ["astro-build.astro-vscode"], | ||
"unwantedRecommendations": [] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodeLinker: node-modules | ||
yarnPath: .yarn/releases/yarn-4.0.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# pages-turbo-workspace-action | ||
> easily deploy sites in a Turbo-powered monorepo with build-scripts to Cloudflare Pages | ||
See the [example](./.github/workflows/example.yml). | ||
|
||
## Usage | ||
```yml | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Deploy | ||
uses: trufflehq/pages-turbo-workspace-action@v1 | ||
with: | ||
# The script to build your site (default: `build`) (joins with `yarn workspace $workspace_name`) | ||
build_script: build | ||
# Cloudflare Account ID | ||
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
# Cloudflare API Token | ||
cloudflare_api_token: ${{ secrets.CLOUDFLARE_PAGES_API_KEY }} | ||
# The directory of static assets to upload (default: `dist`) | ||
directory: dist | ||
# GitHub Token | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# Optional: The script to run before building your site | ||
prebuild_script: yarn turbo | ||
# Optional: The branch to deploy to production | ||
production_branch: ${{ github.event.repository.default_branch }} | ||
# The name of the Cloudflare Pages project | ||
project_name: my-project-name | ||
# The name of the yarn workspace being deployed | ||
workspace_name: web | ||
``` | ||
<!-- build-script: | ||
description: "The script to build your site (default: `build`) (joins with `yarn workspace $workspace-name`)" | ||
required: false | ||
default: "build" | ||
cloudflare-account-id: | ||
description: "Cloudflare Account ID" | ||
required: true | ||
cloudflare-api-token: | ||
description: "Cloudflare API Token" | ||
required: true | ||
directory: | ||
description: "The directory of static assets to upload (default: `dist`)" | ||
required: true | ||
default: "dist" | ||
github-token: | ||
description: "GitHub Token" | ||
required: true | ||
prebuild-script: | ||
description: "The script to run before building your site" | ||
required: false | ||
production-branch: | ||
description: "The branch to deploy to production" | ||
required: true | ||
default: "master" | ||
project-name: | ||
description: "The name of the Cloudflare Pages project" | ||
required: true | ||
workspace-name: | ||
description: "The name of the yarn workspace being deployed" | ||
required: true | ||
deploy-to-branch: | ||
description: "The Cloudflare Pages branch to deploy to" | ||
required: false --> | ||
|
||
## Arguments | ||
| Name | Description | Required | Default | | ||
| --- | --- | --- | --- | | ||
| `build_script` | The script to build your site (default: `build`) (joins with `yarn workspace $workspace_name`) | `false` | `build` | | ||
| `cloudflare_account_id` | Cloudflare Account ID | `true` | | | ||
| `cloudflare_api_token` | Cloudflare API Token | `true` | | | ||
| `directory` | The directory of static assets to upload (default: `dist`) | `true` | `dist` | | ||
| `github_token` | GitHub Token | `true` | | | ||
| `prebuild_script` | The script to run before building your site | `false` | | | ||
| `production_branch` | The branch to deploy to production | `true` | `master` | | ||
| `project_name` | The name of the Cloudflare Pages project | `true` | | | ||
| `workspace_name` | The name of the yarn workspace being deployed | `true` | | | ||
| `deploy_to_branch` | The Cloudflare Pages branch to deploy to | `false` | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: "Publish to Cloudflare Pages" | ||
description: "Publish a Pages project" | ||
inputs: | ||
build-script: | ||
description: "The script to build your site (default: `build`) (joins with `yarn workspace $workspace-name`)" | ||
required: false | ||
default: "build" | ||
cloudflare-account-id: | ||
description: "Cloudflare Account ID" | ||
required: true | ||
cloudflare-api-token: | ||
description: "Cloudflare API Token" | ||
required: true | ||
directory: | ||
description: "The directory of static assets to upload (default: `dist`)" | ||
required: true | ||
default: "dist" | ||
github-token: | ||
description: "GitHub Token" | ||
required: true | ||
prebuild-script: | ||
description: "The script to run before building your site" | ||
required: false | ||
production-branch: | ||
description: "The branch to deploy to production" | ||
required: true | ||
default: "master" | ||
project-name: | ||
description: "The name of the Cloudflare Pages project" | ||
required: true | ||
workspace-name: | ||
description: "The name of the yarn workspace being deployed" | ||
required: true | ||
deploy-to-branch: | ||
description: "The Cloudflare Pages branch to deploy to" | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install node.js v18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
uses: trufflehq/truffle-packages/actions/yarn@main | ||
|
||
- name: Get project directory | ||
id: get-project-directory | ||
shell: bash | ||
run: | | ||
set -ex | ||
dir=$(yarn workspaces list --json | jq -r 'select(.name == "${{ inputs.workspace-name }}") | .location') | ||
echo "Resolved project directory: $dir" | ||
echo "dir=$dir" >> $GITHUB_OUTPUT | ||
- name: Prebuild script | ||
shell: bash | ||
if: ${{ inputs.prebuild-script }} | ||
run: ${{ inputs.prebuild-script }} | ||
|
||
- name: Turbo prune | ||
shell: bash | ||
run: yarn turbo prune --scope=${{ inputs.workspace-name }} | ||
|
||
- name: Build script | ||
shell: bash | ||
if: ${{ inputs.build-script }} | ||
run: yarn turbo run ${{ inputs.build-script }} --filter=${{ inputs.workspace-name }} | ||
|
||
- name: Check if Cloudflare Pages Project exists | ||
shell: bash | ||
id: check-project | ||
run: | | ||
set -ex | ||
echo "Checking if Cloudflare Pages Project exists" | ||
check=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/${{ inputs.cloudflare-account-id }}/pages/projects/${{ inputs.project-name }}" \ | ||
-H "Authorization: Bearer ${{ inputs.cloudflare-api-token }}" \ | ||
-H "Content-Type:application/json" | jq -r '.success') | ||
echo "result=$check" >> $GITHUB_OUTPUT | ||
- name: Create Cloudflare Pages Project (if it doesn't exist) | ||
shell: bash | ||
if: steps.check-project.outputs.result != 'true' | ||
run: | | ||
set -ex | ||
echo "Creating Cloudflare Pages Project exists" | ||
curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/${{ inputs.cloudflare-account-id }}/pages/projects" \ | ||
-H "Authorization: Bearer ${{ inputs.cloudflare-api-token }}" \ | ||
-H "Content-Type:application/json" \ | ||
--data '{"name":"${{ inputs.project-name }}", "production-branch":"${{ inputs.production-branch }}"}' | ||
- name: Publish to Cloudflare Pages | ||
uses: cloudflare/pages-action@v1 | ||
with: | ||
apiToken: ${{ inputs.cloudflare-api-token }} | ||
accountId: ${{ inputs.cloudflare-account-id }} | ||
projectName: ${{ inputs.project-name }} | ||
directory: dist | ||
# Optional: Enable this if you want to have GitHub Deployments triggered | ||
gitHubToken: ${{ inputs.github-token }} | ||
# Optional: Change the working directory | ||
workingDirectory: ${{ steps.get-project-directory.outputs.dir }} | ||
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta` | ||
wranglerVersion: "3" | ||
# Optional: Switch what branch you are publishing to. | ||
# By default this will be the branch which triggered this workflow | ||
branch: ${{ inputs.deploy-to-branch || inputs.production-branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# build output | ||
dist/ | ||
|
||
# generated types | ||
.astro/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Astro Starter Kit: Basics | ||
|
||
```sh | ||
npm create astro@latest -- --template basics | ||
``` | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) | ||
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics) | ||
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json) | ||
|
||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! | ||
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554) | ||
|
||
## 🚀 Project Structure | ||
|
||
Inside of your Astro project, you'll see the following folders and files: | ||
|
||
```text | ||
/ | ||
├── public/ | ||
│ └── favicon.svg | ||
├── src/ | ||
│ ├── components/ | ||
│ │ └── Card.astro | ||
│ ├── layouts/ | ||
│ │ └── Layout.astro | ||
│ └── pages/ | ||
│ └── index.astro | ||
└── package.json | ||
``` | ||
|
||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. | ||
|
||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. | ||
|
||
Any static assets, like images, can be placed in the `public/` directory. | ||
|
||
## 🧞 Commands | ||
|
||
All commands are run from the root of the project, from a terminal: | ||
|
||
| Command | Action | | ||
| :------------------------ | :----------------------------------------------- | | ||
| `npm install` | Installs dependencies | | ||
| `npm run dev` | Starts local dev server at `localhost:4321` | | ||
| `npm run build` | Build your production site to `./dist/` | | ||
| `npm run preview` | Preview your build locally, before deploying | | ||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | ||
| `npm run astro -- --help` | Get help using the Astro CLI | | ||
|
||
## 👀 Want to learn more? | ||
|
||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { defineConfig } from 'astro/config'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "web", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"dev": "astro dev", | ||
"start": "astro dev", | ||
"build": "astro check && astro build", | ||
"preview": "astro preview", | ||
"astro": "astro" | ||
}, | ||
"dependencies": { | ||
"astro": "^3.5.3" | ||
}, | ||
"devDependencies": { | ||
"@astrojs/check": "^0.3.1", | ||
"typescript": "^5.2.2" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.