-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
213 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.