Skip to content

Commit

Permalink
Release updates
Browse files Browse the repository at this point in the history
* Remove hugo workflow
* Update release workflow
* Update Hugo production deployment config

Signed-off-by: Jeremy T. Bouse <[email protected]>
  • Loading branch information
jbouse committed Apr 15, 2024
1 parent f111cfb commit e170929
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 72 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/hugo.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ jobs:
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }}
aws-region: us-east-1

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_PRIVATE_KEY }}
installation_retrieval_mode: id
installation_retrieval_payload: ${{ secrets.GH_INSTALLATION_ID }}

- name: Terraform Format
id: fmt
run: terraform fmt -no-color -check
Expand All @@ -58,6 +67,68 @@ jobs:
id: plan
run: terraform plan -no-color

- uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
// 1. Retrieve existing bot comments for the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})
const botComment = comments.find(comment => {
return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
})
// 2. Prepare format of the comment
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
<details><summary>Validation Output</summary>
\`\`\`\n
${{ steps.validate.outputs.stdout }}
\`\`\`
</details>
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
// 3. If we have a comment, update it, otherwise create a new one
if (botComment) {
github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: output
})
} else {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1

- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -no-color -auto-approve
Expand Down
14 changes: 8 additions & 6 deletions config/production/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ order:
- .webp$
targets:
- name: AWS
URL: 's3://kq4afy.xyz?region=us-east-1'
cloudFrontDistributionID: E24XCU50JVWOD5
URL: "S3_BUCKET_URL"
cloudFrontDistributionID: CLOUDFRONT_DISTRIBUTION_ID
matchers:
- pattern: ^.+\.(js|css|svg|ttf)$
cacheControl: 'max-age=31536000, no-transform, public'
- pattern: ^.+\.(js|css|md|otf|svg|ttf|txt)$
cacheControl: 'max-age=604800, no-transform, public'
gzip: true
- pattern: ^.+\.(png|jpg|webp)$
cacheControl: 'max-age=31536000, no-transform, public'
- pattern: ^.+\.(bmp|gif|ico|jpeg|jpg|mp3|mp4|pdf|png|rss|tiff|woff|woff2)$
cacheControl: 'max-age=604800, no-transform, public'
gzip: false
- pattern: ^sitemap\.xml$
contentType: application/xml
cacheControl: "max-age=3600, no-transform, public"
gzip: true
- pattern: ^.+\.(html|xml|json)$
cacheControl: "max-age=3600, no-transform, public"
gzip: true

0 comments on commit e170929

Please sign in to comment.