Skip to content

Commit

Permalink
🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcguin committed May 16, 2024
1 parent f2ab298 commit efe4fbe
Show file tree
Hide file tree
Showing 43 changed files with 9,660 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches: [main]

jobs:
publish:
name: Publish to Cloudflare Pages
runs-on: ubuntu-latest
strategy:
matrix:
include:
# "project" here corresponds to the name of your project within Cloudflare
# "package" here refers to the name of the site as it is in the monorepo. "project" and "package" may not always be the same
- project: unicorn-demo
package: unicorn-demo

permissions:
contents: read
deployments: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Dependencies
run: npm ci --omit=dev

- name: Build
run: npm run build -w ./sites/${{ matrix.package }}

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.DEPLOY_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ matrix.project }}
directory: ./sites/${{ matrix.package }}/dist
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# build output
dist/
.output/
./sites/*/dist

# 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

# misc
*.pem
.cache
.astro
.vscode
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Unicorn

Unicorn is a monorepo to make it easier to deploy websites alongside your job applications allowing you to customize your pages and content to the specific job opportunity. Unicorn provides a GitHub Action that will deploy your sites as Cloudflare Pages.

Now go show your prospective employers what a special unicorn you are.

## Instructions

To use this monorepo, you'll need a Cloudflare account.

### Create A Cloudflare API Key

1. In your Cloudflare account, navigate to "Profile" -> "API Tokens" -> "Create Token"
2. Under the "Custom token" section, click to create a custom token. Give the token a name and the edit permission to Cloudflare Pages. It should look something like this:

![custom token example screen](./assets/cloudflare_custom_token.png)

### Add GitHub Secrets / Creating Your First Site

1. Copy the token from the previous step and add it as a GitHub secret called `DEPLOY_TOKEN` in your repo.
2. Navigate to the "Workers & Pages" tab. Here you should find your account id. Copy that and add it to your repo as a secret called `CLOUDFLARE_ACCOUNT_ID`.
3. While here, create your first site. Select "create application". Select "Pages" tab. Select "Create using direct upload". Select "Upload assets", although we will be skipping the actual upload of assets (the GH action workflow will do this for us, we just need to create the pages "project" at this point). Give the project a name, and select "Create project" without uploading assets. Take note of the project name you provided. We will use this within the [GitHub action](./.github/workflows/publish.yml#L14).

## Thanks

This project is a minimal fork off of the [Typography](https://github.com/Moeyua/astro-theme-typography) by [Moeyua](https://github.com/Moeyua). Thanks for the design Moeyua!
Binary file added assets/cloudflare_custom_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit efe4fbe

Please sign in to comment.