Skip to content

Commit 8b93c3c

Browse files
authored
Cleanup template (#161)
1 parent 53cdf3f commit 8b93c3c

14 files changed

+51
-39
lines changed

Diff for: .github/workflows/deploy.yml renamed to .github/workflows/template.deploy.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ permissions:
1313
env:
1414
STACK_NAME: portfolio-template
1515
REGION: us-east-1
16-
DOMAIN: portfolio.cal-overflow.dev
17-
NUXT_ENV_SITE_URL: https://portfolio.cal-overflow.dev # This value does not matter here
16+
NUXT_ENV_SITE_URL: https://portfolio.cal-overflow.dev
1817
NUXT_ENV_FULL_NAME: Example Portfolio
1918
NUXT_ENV_EMAIL_ADDRESS: [email protected]
19+
STACK_TEMPLATE_FILE: template/stack.yml
2020

2121
jobs:
2222
acceptance:
@@ -55,21 +55,8 @@ jobs:
5555
aws-region: ${{ env.REGION }}
5656

5757
- name: Deploy stack
58-
run: |
59-
sam deploy --stack-name $STACK_NAME --region $REGION --parameter-overrides "Domain=$DOMAIN"
60-
61-
- name: Build and deploy static site
62-
run: |
63-
mkdir example_content
64-
git clone https://github.com/cal-overflow/example-portfolio-content.git example_content
65-
cp -r example_content/content/* src/content
66-
cp -r example_content/assets/* src/assets
67-
68-
npm ci
69-
npm run generate
70-
71-
BUCKET=$(aws cloudformation describe-stacks --stack-name=$STACK_NAME --region $REGION --query 'Stacks[0].Outputs[?OutputKey==`S3BucketName`].OutputValue' --output text)
72-
aws s3 sync dist s3://$BUCKET
58+
run: ./template/deploy.sh
59+
shell: bash
7360

7461
run_e2e_tests:
7562
needs: deploy

Diff for: .github/workflows/pr-validator.yml renamed to .github/workflows/template.pr-validation.yml

+4-14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
REGION: us-east-1
1717
NUXT_ENV_FULL_NAME: 'Pull Request #${{ github.event.number }}'
1818
NUXT_ENV_EMAIL_ADDRESS: [email protected]
19+
STACK_TEMPLATE_FILE: template/pr.stack.yml
1920

2021
jobs:
2122
acceptance:
@@ -60,19 +61,8 @@ jobs:
6061

6162
- name: Deploy stack & publish site
6263
id: sam-deploy
63-
run: |
64-
sam deploy --stack-name $STACK_NAME --region $REGION -t pr.template.yml
65-
66-
mkdir example_content
67-
git clone https://github.com/cal-overflow/example-portfolio-content.git example_content
68-
cp -r example_content/content/* src/content
69-
cp -r example_content/assets/* src/assets
70-
71-
npm ci
72-
npm run generate
73-
74-
BUCKET=$(aws cloudformation describe-stacks --stack-name=$STACK_NAME --region $REGION --query 'Stacks[0].Outputs[?OutputKey==`S3BucketName`].OutputValue' --output text)
75-
aws s3 sync dist s3://$BUCKET
64+
run: ./template/deploy.sh
65+
shell: bash
7666

7767
- name: Generate Github Actions summary
7868
id: generate-summary
@@ -94,7 +84,7 @@ jobs:
9484
message: |
9585
### Deploy Preview
9686
**Status:** ${{ steps.sam-deploy.outcome }}
97-
**URL:** [${{ env.URL }}](${{ env.URL}})
87+
**URL:** [${{ env.URL }}](${{ env.URL }})
9888
9989

10090
run_e2e_tests:

Diff for: .gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
## Template files:
2-
src/content/*
3-
42
!.gitkeep
53
!.gitignore
64

75

8-
9-
106
# Created by .ignore support plugin (hsz.mobi)
117
### Node template
128
# Logs

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Built primarily with [NuxtJS](https://nuxtjs.org/) and [TailwindCSS](https://tai
99

1010
View the source code for the website [here](https://github.com/cal-overflow/site)
1111
#### Light mode
12-
[![Picture of home screen (light mode)](assets/preview-home-page-light.png)](http://www.cal-overflow.dev)
12+
[![Picture of home screen (light mode)](template/assets/preview-home-page-light.png)](http://www.cal-overflow.dev)
1313

1414
#### Dark mode
15-
[![Picture of home screen (dark mode)](assets/preview-home-page-dark.png)](http://www.cal-overflow.dev)
15+
[![Picture of home screen (dark mode)](template/assets/preview-home-page-dark.png)](http://www.cal-overflow.dev)
1616

1717
</details>
1818

@@ -165,7 +165,7 @@ I have created a [custom Editor component](src/components/development/Editor.vue
165165

166166
| Viewing post | Editing Post |
167167
| :-: | :-: |
168-
| ![Viewing post](assets/viewing-post-example.png) | ![Editing post](assets/editing-post-example.png) |
168+
| ![Viewing post](template/assets/viewing-post-example.png) | ![Editing post](template/assets/editing-post-example.png) |
169169

170170
</details>
171171

Diff for: template/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Template files
2+
3+
The files within this folder are specific to the template. You can safely ignore the contents within this folder.
4+
5+
### About these files
6+
7+
#### `assets/`
8+
Images used in the template repository [README.md](../README.md)
9+
10+
#### `stack.yml`
11+
The AWS Cloudformation stack for the [portfolio.cal-overflow.dev](https://portfolio.cal-overflow.dev) template site.
12+
13+
#### `pr.stack.yml`
14+
The AWS Cloudformation stack for the PR deploy previews.
15+
16+
#### `samconfig.toml`
17+
The [AWS SAM](https://aws.amazon.com/serverless/sam/) configuration file.
18+
19+
#### `deploy.sh`
20+
Bash script reused by workflows when deploying the Cloudformation stack and syncing the static website in an S3 bucket.
21+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: template/deploy.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
sam deploy \
3+
-t $STACK_TEMPLATE_FILE \
4+
--stack-name $STACK_NAME \
5+
--config-file ./samconfig.toml \
6+
--region $REGION
7+
8+
mkdir example_content
9+
git clone https://github.com/cal-overflow/example-portfolio-content.git example_content
10+
cp -r example_content/content/* src/content
11+
cp -r example_content/assets/* src/assets
12+
13+
npm ci
14+
npm run generate
15+
16+
BUCKET=$(aws cloudformation describe-stacks --stack-name=$STACK_NAME --region $REGION --query 'Stacks[0].Outputs[?OutputKey==`S3BucketName`].OutputValue' --output text)
17+
aws s3 sync dist s3://$BUCKET
18+

Diff for: pr.template.yml renamed to template/pr.stack.yml

File renamed without changes.

Diff for: samconfig.toml renamed to template/samconfig.toml

File renamed without changes.

Diff for: template.yml renamed to template/stack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description: "AWS resources for a static website with a custom domain"
44
Parameters:
55
Domain:
66
Type: String
7-
Default: cal-overflow.dev
7+
Default: portfolio.cal-overflow.dev
88

99
HostedZone:
1010
Type: String

0 commit comments

Comments
 (0)