Skip to content

Commit

Permalink
Add new main site
Browse files Browse the repository at this point in the history
  • Loading branch information
ptoffy committed Jun 18, 2024
1 parent fa48884 commit d6e9e5c
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 105 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and deploy vapor.codes

on:
push:
branches:
- main

jobs:
build:
name: Build and deploy
runs-on: ubuntu-latest
container: swift:5.10-jammy
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build site
run: swift run
- name: Configure AWS credentials
id: cred
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }}
aws-region: "eu-west-2"
- name: Deploy to AWS Cloudformation
id: clouddeploy
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: vapor-main-site-stack
template: stack.yml
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
DomainName=vapor.codes,
S3BucketName=vapor-main-site,
AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }}
- name: Deploy to S3
id: s3deploy
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --exclude 'feed.rss'
env:
AWS_S3_BUCKET: "vapor-main-site"
AWS_ACCESS_KEY_ID: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }}
AWS_REGION: "eu-west-2"
SOURCE_DIR: "dist"
- name: Invalidate CloudFront
uses: awact/cloudfront-action@master
env:
SOURCE_PATH: "/*"
AWS_REGION: "eu-west-2"
AWS_ACCESS_KEY_ID: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }}
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }}
60 changes: 0 additions & 60 deletions .github/workflows/deployToAws.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pr-closed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PR - Closed

on:
pull_request:
branches:
- main
types: [closed]

jobs:
delete-s3:
name: Delete S3 Website
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/website' && github.actor != 'dependabot[bot]' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Delete Website Bucket
uses: rishabhrao/s3-website-https-pr-action@v1
with:
bucket-prefix: "vapor-website-pulls"
56 changes: 56 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main

jobs:
build:
name: Test, Build, and Deploy
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/blog' && github.actor != 'dependabot[bot]' }}
with:
aws-access-key-id: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup CloudFormation linter
uses: ScottBrenner/cfn-lint-action@v2
- name: Run CloudFormation linter
run: cfn-lint -t stack.yaml
- name: Build site
run: swift run
- name: Create S3 Bucket
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/website' && github.actor != 'dependabot[bot]' }}
env:
BUCKET: ${{ format('vapor-website-pulls-pr{0}', github.event.number) }}
run: |
if aws s3api head-bucket --bucket ${BUCKET} 2>/dev/null; then
echo "Bucket already exists"
else
aws s3 mb s3://${BUCKET}
aws s3api delete-public-access-block --bucket ${BUCKET}
aws s3api delete-bucket-ownership-controls --bucket ${BUCKET}
aws s3api put-bucket-website --bucket ${BUCKET} \
--website-configuration '{"IndexDocument":{"Suffix":"index.html"},"ErrorDocument":{"Key":"404.html"}}'
fi
- name: Deploy S3 Website
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/website' && github.actor != 'dependabot[bot]' }}
uses: brokenhandsio/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bucket-prefix: "vapor-website-pulls"
folder-to-copy: "./Output"
bucket-region: "us-east-1"
Binary file added Resources/static/images/brokenhands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/static/images/emerge-tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/static/images/omrd.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 d6e9e5c

Please sign in to comment.