Use tea to build the website

This commit is contained in:
mxcl 2022-07-07 16:18:49 -04:00 committed by Max Howell
parent 4492748bde
commit c5d847d541
No known key found for this signature in database
GPG key ID: 741BB84EF5BB9EEC
5 changed files with 67 additions and 94 deletions

3
.github/mk-pantry-accessible.sh vendored Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
git config --global url."https://teaxyz:$1@github.com/teaxyz/pantry".insteadOf "https://github.com/teaxyz/pantry"

View file

@ -3,34 +3,32 @@ on:
branches:
- main
paths-ignore:
- '**/*.md'
- '*.md'
concurrency:
group: deploy
cancel-in-progress: true
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Create Deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ github.token }}
env: aws
- uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- uses: teaxyz/setup@v0
with:
hugo-version: 'latest'
- name: Build
run: hugo -s src -d ../public --minify
target: build
## means s3 sync will only sync things we need syncd
- uses: chetan/git-restore-mtime-action@v1
@ -61,13 +59,11 @@ jobs:
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
--paths '/*'
- name: Seal Deployment
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
token: ${{ github.token }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }}

View file

@ -9,12 +9,10 @@ jobs:
steps:
- name: inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
- name: set STAGE variable in environment for next steps
- name: Set STAGE variable in environment for next steps
run: echo "STAGE=pr-${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV
- name: checkout the files
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
@ -22,12 +20,10 @@ jobs:
# there is a bug with the actions/cache used in bahmutov/npm-install@v1 on "closed" event
# more infos here : https://github.com/actions/cache/issues/478
- name: install node dependencies
run: yarn --frozen-lockfile
- run: yarn --frozen-lockfile
working-directory: .cdk
- name: configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@ -37,12 +33,12 @@ jobs:
- name: lol wut? don't look at this.
run: mkdir public
- name: destroy the stack on AWS
- name: Destroy the stack on AWS
run: yarn destroy
working-directory: .cdk
- name: delete the github deployments and the corresponding environment
- name: Delete the github deployments and the corresponding environment
uses: strumwolf/delete-deployment-environment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: ${{ env.STAGE }}
environment: ${{ env.STAGE }}

View file

@ -1,18 +1,19 @@
on:
pull_request:
on: pull_request
concurrency:
group: ${{ github.event.number }}
cancel-in-progress: true
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
- name: set STAGE variable in environment for next steps
- name: Set STAGE variable in environment for next steps
run: echo "STAGE=pr-${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV
- name: Create Deployment
@ -20,27 +21,29 @@ jobs:
id: deployment
with:
step: start
token: ${{ github.token }}
env: ${{ env.STAGE }}
ref: ${{ github.head_ref }}
no_override: false
transient: true
override: true
- uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
- name: Staging configuration
- name: Apply Staging Configuration
run: |
sed -i -e 's/^baseURL\s*=.*$/baseUrl = ""/i' config.toml
echo "relativeurls = true" >>config.toml
working-directory: src
- name: Build
run: hugo -s src -d ../public
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
- uses: teaxyz/setup@v0
with:
target: build
- uses: actions/setup-node@v3
with:
node-version: 14
- uses: bahmutov/npm-install@v1
with:
working-directory: .cdk
- uses: aws-actions/configure-aws-credentials@v1
with:
@ -48,15 +51,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: actions/setup-node@v3
with:
node-version: 14
- name: install node dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: .cdk
- name: deploy the stack on AWS
- name: Deploy to AWS
id: cdk_deploy
run: yarn deploy
working-directory: .cdk
@ -66,7 +61,6 @@ jobs:
if: always()
with:
step: finish
token: ${{ github.token }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ env.STAGE }}

View file

@ -1,65 +1,49 @@
![tea](https://tea.xyz/banner.png)
Deploys to [tea.xyz](https://tea.xyz).
Deploys to [tea.xyz].
# Conditions of Use
# Legal
This repo is open source, but you may not publish this website in an attempt
to masquerade as tea.inc. Trademark law has our back here.
You may not publish this website in an attempt to masquerade as tea.inc.
The tea logo and wordmark are registered trademarks of tea.inc.
# Getting Started
# Contributing
* The site is built with [Hugo] and [Bootstrap].
* `.html` files in [`./src/layouts/page/`] have a corresponding `.md` file in [`./src/content/`].
* Repeated components are in [`./src/layouts/partials/`].
## Getting Started
hugo can render your edits while you work:
```sh
hugo serve --watch -D
hugo serve --watch --buildDrafts --source src
```
## Dependencies
# Editing/Syntax
This site is has been built with the help of [Bootstrap] for CSS/JS heavy-lifting and [HUGO] for templating and DRY development. HUGO must be installed locally in order to adequately preview development via terminal command `hugo server`. Partials/repeated components can be be found in [`layouts/partials`]. Each HTML page ([`layouts/page`]) must have a corresponding Markdown file in the [`content`] folder.
# Creating a New Page
1. Create a new HTML file in [`layouts/page`].
2. Define the content section via `{{ define "main" }}` prior to proposed content area, and `{{ end }}` after proposed content area. User this HTML file to affect layout and styling. Content may be added via the corresponding `.md` file (see step 3)
3. Create an `.md` file in the [`content`] folder and provide the appropriate metadata. For example:
```yaml
title: "White Paper" # (How this page will appear in the menu)
Description: "tea.white paper" # (Populates as page title)
layout: "white-paper" # (the associated HTML file)
menu: main # (Assign a menu)
weight: 7 # (Order in which this item will appear)
```
Following that, begin typing content. This will populate in the section of your HTML document that has been defined as `main`.
4. If adding a menu link for an external source or ID, edit the [`config.toml`](config.toml) accordingly.
5. Run with `hugo serve --watch -D`.
# Editing Partials/Repeated Components
Partials may be edited in plain HTML. No additional [HUGO] syntax is required.
# Defining Partial Locations
Partials are defined via the `baseof.html` file in [`layouts/default`]. This informs the layout of a newly generated page. Insert new partials via the syntax `{{- partial "partial.html" -}}`.
# Dependencies
Install hugo yourself or use tea: `sh <(curl tea.xyz) hugo`.
| Project | Version |
|------------|---------|
| nodejs.org | ^18 |
| gohugo.io | ^0.99 |
| bootstrap | ^5 |
| jquery | ^3.6 |
| gohugo.io | >=0.99 |
# Build
Builds a static, deployable version of the website.
```sh
hugo --source src --destination ../public --minify
```
[tea.xyz]: https://tea.xyz
[Bootstrap]: https://getbootstrap.com/docs/5.2/getting-started/introduction/
[HUGO]: https://gohugo.io/documentation/
[`content`]: content/
[`layouts/page`]: layouts/page/
[`layouts/partials`]: layouts/partials/
[`layouts/default`]: layouts/default/
[Hugo]: https://gohugo.io/documentation/
[`./src/layouts/page/`]: src/layouts/page
[`./src/content/`]: src/content
[`./src/layouts/partials/`]: src/layouts/partials