Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update codebase to reflect the latest configuration in the parent open-sdg and open-sdg-site project #26

Merged
merged 11 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "Ruby",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.11"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// not used as we are using --network=host, see below
// "forwardPorts": [
// // Jekyll Server
// 4000,
// // Live Reload Server
// 35729
// ],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bundle install --path=vendor/bundle",

// allow the container to talk to ports on the host
"runArgs": [ "--network=host" ]

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug Report
about: Report a Bug
title: ''
labels: bug
assignees: ''

---

<!---
Please read this!

Before opening a new issue, make sure to search for keywords in the issues
filtered by the "bug" and verify the issue you're about to submit isn't a duplicate.
--->

### Summary

<!-- Summarize the bug encountered concisely. -->

### Steps to reproduce

<!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. -->

### What is the current *bug* behavior?

<!-- Describe what actually happens. -->

### What is the expected *correct* behavior?

<!-- Describe what you should see instead. -->

### Relevant logs and/or screenshots

<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->

### Possible fixes

<!-- If you can, link to the line of code that might be responsible for the problem. -->
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/general_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: General Issue
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

<!---
Please read this!

Before opening a new issue, make sure to search for relevant keywords in the issues
and verify the issue you're about to submit isn't a duplicate.
--->

### Problem

<!-- Describe the general issue -->

### Background Info

<!-- If you can, provide how may we resolve the particular problem? -->

### Proposed Solution

<!-- If you can, provide how may we resolve the particular problem? -->
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### What does this PR do?

<!-- Provide information of what the changes in this PR do. This may include both code changes and
application behavior -->

### Background info

<!-- Provide relevant information for this PR, such as why it was opened, reasons for the changes, what
needs to noted moving forward, etc. -->

### How can this be tested (manually and/or automated test)?

<!-- Provide steps to manually test the changes if applicable -->
#### Provide manual tests steps if applicable

<!-- Provide steps to run our test tools to test the changes if applicable -->
#### Provide steps for running automated tests if applicable

### Which issue(s) is/are related to this PR?

<!-- List the issues with #<issue-number> -->
This PR is/are related to issue(s)

<!-- List close #<issue-number> for the issues that can be closed by this PR -->
close
94 changes: 42 additions & 52 deletions .github/workflows/BuildNDeployDev.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
# This workflow will checkout the contents of the `development` branch of this repo, remove all files in the current S3 bucket, and push the contents
# to the bucket. Once the contents of the S3 bucket has been updated, a call will be made to invalidate the cache in the CloudFront distribution.
# The CloudFront distribution is configured to pull the contents from the S3 bucket once an `invalidation` request is sent.

name: Build and Deploy Development Static Site
name: Build and Deploy Development Static Site Dev # run this workflow when a push has been made. if a push has been made to the development branch it will deploy the site to the hosting environment

on: # run this workflow when a push has been made to `development` branch
push:
branches:
- development
branches-ignore:
- production
repository_dispatch: # Listen for repository dispatch event from open-sdg-data-starter workflow
types: [dev_triggered_from_open-sdg-data-starter]

jobs:
deploy:
runs-on: ubuntu-20.04
environment:
name: development
url: https://${{ vars.SITE_DOMAIN_NAME }}
steps:
###########################################################################################################
# This is the CI portion
###########################################################################################################
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: development
uses: actions/checkout@v4

- name: Setup Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6' # Version range or exact version of a Ruby version to use, using semvers version range syntax.


- name: Cache and Install Gem files
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
ruby-version: '3.2' # Version range or exact version of a Ruby version to use, using semvers version range syntax.

- name: Install Ruby dependencies
run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
Expand All @@ -47,38 +27,48 @@ jobs:
run: bundle exec jekyll build --config _config.yml

- name: Test the HTML # test our rendered html files
run: bash scripts/test/html_proofer.sh
###########################################################################################################
# This is the CD portion
###########################################################################################################
#- uses: actions/checkout@v1 # checks out the code in the repository
- name: Setup Python
uses: actions/setup-python@v4 # sets up python in our environment
run: bash scripts/test/html_proofer_staging.sh

- name: Zip site artifact # only zip the site if the push was made to the development branch
if: ${{ github.ref == 'refs/heads/development' }}
run: zip -r _site.zip _site

- name: Upload site artifact # only upload the zip if the push was made to the development branch
if: ${{ github.ref == 'refs/heads/development' }}
uses: actions/upload-artifact@v4
with:
python-version: '3.x' # install python version 3.x, default architecture is x64


name: site-deployment-dev
path: _site.zip
retention-days: 1 # delete the artifact after 1 day

deploy:
runs-on: ubuntu-22.04
needs: [build]
if: (github.ref == 'refs/heads/development')
environment:
name: development
url: https://${{ vars.SITE_DOMAIN_NAME }}
steps:
- name: Install AWS CLI
run: pip3 install awscli --upgrade --user # install the cli with upgrade to any requirements and into the subdir of the user



- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16 # use the official GitHub Action from AWS to setup credentials
uses: aws-actions/configure-aws-credentials@v4 # use the official GitHub Action from AWS to setup credentials
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true

- name: Fetch site artifact
uses: actions/download-artifact@v4
with:
name: site-deployment-dev

- name: Unzip site artifact
run: unzip _site.zip


- name: Push Contents to S3 # push the current working directory to the S3 bucket
run: aws s3 sync _site/ s3://${{ secrets.S3_BUCKET_NAME }} --exclude ".git/*" --exclude ".github/*" --delete # have the bucket have the same content in the repo & exclude the git related directories.


- name: Invalidate CloudFront Cache # Invalidate the CloudFront Distribution Cache to get contents from the S3 bucket
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*"



run: aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths "/*"
42 changes: 9 additions & 33 deletions .github/workflows/BuildNDeployProd.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# This workflow will checkout the contents of the `production` branch of this repo, remove all files in the current S3 bucket, and push the contents
# to the bucket. Once the contents of the S3 bucket has been updated, a call will be made to invalidate the cache in the CloudFront distribution.
# The CloudFront distribution is configured to pull the contents from the S3 bucket once an `invalidation` request is sent.

name: Build and Deploy Production Static Site
name: Build and Deploy Production Static Site Prod # run this workflow when a push has been made to production branch

on: # run this workflow when a push has been made to `Jekyll-Alf` branch
push:
Expand All @@ -13,7 +10,7 @@ on: # run this workflow when a push has been made to `Jekyll-Alf` branch

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
environment:
name: production
url: https://${{ vars.SITE_DOMAIN_NAME }}
Expand All @@ -22,22 +19,14 @@ jobs:
# This is the CI portion
###########################################################################################################
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: production

- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6' # Version range or exact version of a Ruby version to use, using semvers version range syntax.

- name: Cache and Install Gem files
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
ruby-version: '3.2' # Version range or exact version of a Ruby version to use, using semvers version range syntax.

- name: Install Ruby dependencies
run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
Expand All @@ -46,37 +35,24 @@ jobs:
run: bundle exec jekyll build --config _config.yml,_config_prod.yml

- name: Test the HTML # test our rendered html files
run: bash scripts/test/html_proofer.sh
run: bash scripts/test/html_proofer_prod.sh

###########################################################################################################
# This is the CD portion
###########################################################################################################

#- uses: actions/checkout@v1 # checks out the code in the repository
- name: Setup Python
uses: actions/setup-python@v4 # sets up python in our environment
with:
python-version: '3.x' # install python version 3.x, default architecture is x64



- name: Install AWS CLI
run: pip3 install awscli --upgrade --user # install the cli with upgrade to any requirements and into the subdir of the user


- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16 # use the official GitHub Action from AWS to setup credentials
uses: aws-actions/configure-aws-credentials@v4 # use the official GitHub Action from AWS to setup credentials
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true


- name: Push Contents to S3 # push the current working directory to the S3 bucket
run: aws s3 sync _site/ s3://${{ secrets.S3_BUCKET_NAME }} --exclude ".git/*" --exclude ".github/*" --delete # have the bucket have the same content in the repo & exclude the git related directories.

- name: Invalidate CloudFront Cache # Invalidate the CloudFront Distribution Cache to get contents from the S3 bucket
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*"



run: aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths "/*"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ _site/
.spyproject/
*__pycache__/
*.Rproj
Gemfile.lock
deploy_key*
deploy_key*.pub
*.keybase
vendor/
_test/
9 changes: 6 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source "https://rubygems.org"

gem "jekyll", "3.8.4"
gem "html-proofer"
gem "jekyll", "3.9.3"
gem "html-proofer", "3.19.4"
gem "jekyll-remote-theme"
gem "jekyll-open-sdg-plugins", "~> 0.0.15"
gem "deep_merge"
gem "jekyll-open-sdg-plugins", "2.3.0"
gem "kramdown-parser-gfm"
gem "webrick"
Loading
Loading