-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1393 from ArmDeveloperEcosystem/main
Prod update
- Loading branch information
Showing
7 changed files
with
200 additions
and
99 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 |
---|---|---|
@@ -1,69 +1,66 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
name: Deploy Hugo to S3 | ||
|
||
name: content-deploy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push to production branch | ||
push: | ||
branches: [ production ] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
target: | ||
description: "Hugo target to deploy to" | ||
required: true | ||
type: string | ||
aws-region: | ||
description: "AWS Region to use for fetching credentials" | ||
required: false | ||
type: string | ||
default: "us-west-2" | ||
secrets: | ||
AWS_OIDC_ROLE: | ||
required: true | ||
HUGO_LLM_API: | ||
required: true | ||
|
||
env: | ||
HUGO_VERSION: 0.130.0 | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build_and_deploy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true # Fetch Hugo Themes | ||
fetch-depth: 0 | ||
submodules: true # Fetch Hugo Themes | ||
fetch-depth: 0 | ||
|
||
# Sets Up Hugo | ||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: '0.130.0' | ||
extended: true | ||
# Post-CSS install | ||
hugo-version: ${{ env.HUGO_VERSION }} | ||
extended: true | ||
|
||
# Installs Post-CSS | ||
- name: Install Post-CSS | ||
run: npm install postcss-cli | ||
|
||
# Builds arm-learning-paths repo | ||
- name: AWS Github OIDC Login | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }} | ||
aws-region: ${{ inputs.aws-region }} | ||
|
||
# Builds arm-software-developer repo | ||
- name: Build | ||
run: | | ||
hugo --minify | ||
cp learn-image-sitemap.xml public/learn-image-sitemap.xml | ||
bin/pagefind --site "public" | ||
env: | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} | ||
|
||
# Copy SSH Key | ||
- name: copy key | ||
run: | | ||
echo $SSH_KEY | xargs -n 1 > tmpkey | ||
base64 -d < tmpkey > key | ||
chmod 400 key | ||
shell: bash | ||
env: | ||
SSH_KEY: ${{secrets.SSH_KEY}} | ||
|
||
# SCP Site contents to netstorage | ||
- name: copy site content | ||
run: | | ||
cd public | ||
zip -r public.zip . | ||
cd .. | ||
scp -i key -o StrictHostKeyChecking=accept-new -oHostKeyAlgorithms=+ssh-dss -r public/public.zip $USR@$HOST:/$ID/ | ||
shell: bash | ||
env: | ||
USR: ${{secrets.SSH_USERNAME}} | ||
HOST: ${{secrets.SSH_HOST}} | ||
ID: ${{secrets.ID}} | ||
|
||
# Deploys website to AWS S3 and invalidate CloudFront Cache | ||
- name: Deploy to S3 | ||
run: hugo deploy --force --maxDeletes -1 --invalidateCDN --target ${{ inputs.target }} |
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 |
---|---|---|
@@ -1,56 +1,63 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
# This workflow will be triggered on a push to the 'main' branch automatically or when called manually. | ||
# Upon running this workflow, the website will be built and deployed to the internal instance. | ||
name: Build and Deploy Internal Website | ||
|
||
name: build-and-deploy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
# Runs on pushes to the 'main' branch | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
# Allows to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build_and_deploy_s3: | ||
build_and_deploy_internal_existing: | ||
name: Build and Deploy Internal Existing | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true # Fetch Hugo Themes | ||
fetch-depth: 0 | ||
submodules: true # Fetch Hugo Themes | ||
fetch-depth: 0 | ||
|
||
# Sets Up Hugo | ||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: '0.130.0' | ||
extended: true | ||
hugo-version: "0.130.0" | ||
extended: true | ||
|
||
# Post-CSS install and Node.js | ||
- name: Install Post-CSS | ||
run: npm install postcss-cli | ||
|
||
|
||
# Builds arm-software-developer repo | ||
- name: Build | ||
run: | | ||
hugo --minify | ||
cp learn-image-sitemap.xml public/learn-image-sitemap.xml | ||
bin/pagefind --site "public" | ||
env: | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} | ||
|
||
# Deploys website to AWS S3 | ||
- name: Deploy to S3 | ||
run: hugo deploy --force --maxDeletes -1 --invalidateCDN | ||
run: hugo deploy --force --maxDeletes -1 --invalidateCDN --target internal-existing | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
build_and_deploy_internal: | ||
name: Build and Deploy Internal | ||
uses: ./.github/workflows/deploy.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
target: internal | ||
secrets: | ||
AWS_OIDC_ROLE: ${{ secrets.AWS_OIDC_ROLE_INTERNAL }} | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} |
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,79 @@ | ||
# This workflow will be triggered on a push to the 'production' branch automatically or when called manually. | ||
# Upon running this workflow, the website will be built and deployed to the production instance. | ||
name: Build and Deploy Production Website | ||
|
||
on: | ||
# Runs on pushes to the 'production' branch | ||
push: | ||
branches: [production] | ||
|
||
# Allows to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_deploy_existing: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true # Fetch Hugo Themes | ||
fetch-depth: 0 | ||
|
||
# Sets Up Hugo | ||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: "0.130.0" | ||
extended: true | ||
|
||
# Post-CSS install | ||
- name: Install Post-CSS | ||
run: npm install postcss-cli | ||
|
||
# Builds arm-learning-paths repo | ||
- name: Build | ||
run: | | ||
hugo --minify | ||
cp learn-image-sitemap.xml public/learn-image-sitemap.xml | ||
bin/pagefind --site "public" | ||
env: | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} | ||
|
||
# Copy SSH Key | ||
- name: copy key | ||
run: | | ||
echo $SSH_KEY | xargs -n 1 > tmpkey | ||
base64 -d < tmpkey > key | ||
chmod 400 key | ||
shell: bash | ||
env: | ||
SSH_KEY: ${{secrets.SSH_KEY}} | ||
|
||
# SCP Site contents to netstorage | ||
- name: copy site content | ||
run: | | ||
cd public | ||
zip -r public.zip . | ||
cd .. | ||
scp -i key -o StrictHostKeyChecking=accept-new -oHostKeyAlgorithms=+ssh-dss -r public/public.zip $USR@$HOST:/$ID/ | ||
shell: bash | ||
env: | ||
USR: ${{secrets.SSH_USERNAME}} | ||
HOST: ${{secrets.SSH_HOST}} | ||
ID: ${{secrets.ID}} | ||
|
||
build_and_deploy_production: | ||
name: Build and Deploy Production | ||
uses: ./.github/workflows/deploy.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
target: production | ||
secrets: | ||
AWS_OIDC_ROLE: ${{ secrets.AWS_OIDC_ROLE_PRODUCTION }} | ||
HUGO_LLM_API: ${{ secrets.HUGO_LLM_API }} |
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
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,8 @@ | ||
+++ | ||
title = "Request Error" | ||
description = "We are unable to serve this request at the moment." | ||
+++ | ||
|
||
# Request cannot be served | ||
|
||
We are unable to serve this request at the moment. Try going back to our [home page](/). |
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
Oops, something went wrong.