-
Notifications
You must be signed in to change notification settings - Fork 60
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
1 parent
026f91a
commit 5f281a1
Showing
4 changed files
with
206 additions
and
12 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 |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
push: | ||
branches: | ||
- v*.* | ||
paths-ignore: | ||
- 'github/**' | ||
|
||
jobs: | ||
env: | ||
|
@@ -37,8 +39,8 @@ jobs: | |
echo "Deploying $CURRENT_BRANCH which is not the latest version ( => $NEWEST_VERSION )..." | ||
fi | ||
install-dependencies: | ||
name: install dependencies | ||
install-dependencies-and-deploy: | ||
name: Install Dependencies and Deploy | ||
needs: [env] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -63,12 +65,7 @@ jobs: | |
git config user.name "circleci-runai" | ||
git config user.email "[email protected]" | ||
deploy: | ||
name: deploy mkdocs | ||
needs: [env, install-dependencies] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: deploy mkdocs latest | ||
- name: deploy mkdocs | ||
run: | | ||
if [[ "${{ needs.env.outputs.CURRENT_BRANCH }}" == "${{ needs.env.outputs.NEWEST_VERSION }}" ]]; then | ||
echo "Deploying ${{ needs.env.outputs.NEWEST_VERSION }} as latest..." | ||
|
@@ -87,7 +84,7 @@ jobs: | |
slack-notification: | ||
name: Slack Notification | ||
needs: [env, install-dependencies, deploy] | ||
needs: [env, install-dependencies-and-deploy] | ||
if: always() | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -96,8 +93,8 @@ jobs: | |
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} | ||
SLACK_TITLE: "Airgapped package for ${{ inputs.env }} environment ${{ contains(needs.*.result, 'failure') && 'failed' || 'finished successfully' }}" | ||
SLACK_TITLE: "RunAI-Docs: Version ${{ needs.env.outputs.CURRENT_BRANCH }} Deployment ${{ contains(needs.*.result, 'failure') && 'failed' || 'completed successfully' }}" | ||
SLACK_MESSAGE_ON_SUCCESS: "Docs were updated successfully for version ${{ needs.env.outputs.TITLE }}" | ||
SLACK_MESSAGE_ON_FAILURE: "Docs update FAILED for version ${{ needs.env.outputs.TITLE }}" | ||
MSG_MINIMAL: true | ||
SLACK_FOOTER: "" | ||
SLACK_FOOTER: "" |
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,110 @@ | ||
# name: Create Preview Env using S3 and CloudFront | ||
|
||
# on: | ||
# pull_request: | ||
# types: | ||
# - opened | ||
# - reopened | ||
# - synchronize | ||
# - closed | ||
# branches: | ||
# - master | ||
# - v*.* | ||
# env: | ||
# PR_NUMBER: ${{ github.event.number }} | ||
|
||
# jobs: | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Install AWS CLI | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install awscli -y | ||
|
||
# - name: Sync S3 bucket | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws s3 sync ./docs s3://your-bucket-name | ||
|
||
# - name: Invalidate CloudFront cache | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" | ||
|
||
# preview: | ||
# runs-on: ubuntu-latest | ||
# if: github.event_name == 'pull_request' | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v2 | ||
|
||
# - name: Install AWS CLI | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install awscli -y | ||
|
||
# - name: Sync S3 bucket for preview | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws s3 sync ./docs s3://your-bucket-name/${{ env.PR_NUMBER }} | ||
|
||
# - name: Invalidate CloudFront cache | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/${{ env.PR_NUMBER }}/*" | ||
|
||
# - name: Output preview URL | ||
# run: | | ||
# echo "Preview environment URL: https://your-cloudfront-domain/${{ env.PR_NUMBER }}/" | ||
|
||
# - name: Comment on PR with preview URL | ||
# uses: actions/github-script@v6 | ||
# with: | ||
# script: | | ||
# github.rest.issues.createComment({ | ||
# issue_number: context.issue.number, | ||
# owner: context.repo.owner, | ||
# repo: context.repo.repo, | ||
# body: `Preview environment URL: https://your-cloudfront-domain/${{ env.PR_NUMBER }}/` | ||
# }) | ||
|
||
# cleanup: | ||
# runs-on: ubuntu-latest | ||
# if: github.event_name == 'pull_request' && github.event.action == 'closed' | ||
# steps: | ||
# - name: Install AWS CLI | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install awscli -y | ||
|
||
# - name: Remove PR directory from S3 bucket | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws s3 rm s3://your-bucket-name/pr-${{ env.PR_NUMBER }} --recursive | ||
|
||
# - name: Invalidate CloudFront cache | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
# run: | | ||
# aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/pr-${{ env.PR_NUMBER }}/*" |
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,87 @@ | ||
name: Create Preview Environment | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, closed] | ||
branches: | ||
- master | ||
- v*.* | ||
|
||
jobs: | ||
build-and-deploy: | ||
if: github.event.action != 'closed' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' # caching pip dependencies | ||
|
||
- name: install dependencies | ||
run: | | ||
pip3 install -r requirements.txt | ||
- name: mkdocs-build-action | ||
run: | | ||
mkdocs build | ||
- name: Install AWS CLI | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install awscli -y | ||
- name: Sync S3 bucket for preview | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
run: | | ||
aws s3 sync ./site/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/PR-${{ github.event.number }} --delete | ||
- name: Invalidate CloudFront cache | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
run: | | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/PR-${{ github.event.number }}/*" | ||
- name: Comment on PR with preview URL | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `Preview environment URL: https://your-cloudfront-domain/PR-${{ github.event.number }}/` | ||
}) | ||
cleanup: | ||
if: github.event.action == 'closed' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install AWS CLI | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install awscli -y | ||
- name: Remove PR directory from S3 bucket | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
run: | | ||
aws s3 rm s3://${{ secrets.AWS_S3_BUCKET_NAME }}/PR-${{ github.event.number }} --recursive | ||
- name: Invalidate CloudFront cache | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
run: | | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/PR-${{ github.event.number }}/*" |
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