Merge pull request #53 from teaxyz/with-tea

Deploy /w tea
This commit is contained in:
Max Howell 2022-08-23 07:39:26 -04:00 committed by GitHub
commit 6c3377627a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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: branches:
- main - main
paths-ignore: paths-ignore:
- '**/*.md' - '*.md'
concurrency: concurrency:
group: deploy group: deploy
cancel-in-progress: true cancel-in-progress: true
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps: steps:
- name: Create Deployment - name: Create Deployment
uses: bobheadxi/deployments@v1 uses: bobheadxi/deployments@v1
id: deployment id: deployment
with: with:
step: start step: start
token: ${{ github.token }}
env: aws env: aws
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup Hugo - run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
uses: peaceiris/actions-hugo@v2 - uses: teaxyz/setup@v0
with: with:
hugo-version: 'latest' target: build
- name: Build
run: hugo -s src -d ../public --minify
## means s3 sync will only sync things we need syncd ## means s3 sync will only sync things we need syncd
- uses: chetan/git-restore-mtime-action@v1 - uses: chetan/git-restore-mtime-action@v1
@ -61,13 +59,11 @@ jobs:
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \ --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
--paths '/*' --paths '/*'
- name: Seal Deployment - name: Seal Deployment
uses: bobheadxi/deployments@v1 uses: bobheadxi/deployments@v1
if: always() if: always()
with: with:
step: finish step: finish
token: ${{ github.token }}
status: ${{ job.status }} status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }} deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }} env: ${{ steps.deployment.outputs.env }}

View file

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

View file

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

View file

@ -1,65 +1,49 @@
![tea](https://tea.xyz/banner.png) ![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 You may not publish this website in an attempt to masquerade as tea.inc.
to masquerade as tea.inc. Trademark law has our back here. 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 ```sh
hugo serve --watch -D hugo serve --watch --buildDrafts --source src
``` ```
## Dependencies
# Editing/Syntax Install hugo yourself or use tea: `sh <(curl tea.xyz) hugo`.
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
| Project | Version | | Project | Version |
|------------|---------| |------------|---------|
| nodejs.org | ^18 | | gohugo.io | >=0.99 |
| gohugo.io | ^0.99 |
| bootstrap | ^5 |
| jquery | ^3.6 |
# 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/ [Bootstrap]: https://getbootstrap.com/docs/5.2/getting-started/introduction/
[HUGO]: https://gohugo.io/documentation/ [Hugo]: https://gohugo.io/documentation/
[`content`]: content/ [`./src/layouts/page/`]: src/layouts/page
[`layouts/page`]: layouts/page/ [`./src/content/`]: src/content
[`layouts/partials`]: layouts/partials/ [`./src/layouts/partials/`]: src/layouts/partials
[`layouts/default`]: layouts/default/