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

Add Action to Move Current Regulations to History (#1191) #1273

Merged
merged 1 commit into from
Jan 9, 2025
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
28 changes: 28 additions & 0 deletions .github/workflows/cycle-regulations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Move Regulations to History

on:
workflow_dispatch:
inputs:
folder_name:
required: true
description: The name of the sub folder to move the regulations to, usually the date the regulations come out like '2023-08-01'

jobs:
move:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Move current version to the history
run: |
aws s3 cp s3://wca-regulations/index.html.erb ./input.html.erb
# Add info about it not being the official version
sed -E 's/<br\/>/\<br\>\<b\>This is NOT the current official version\<\/b\>\<br\>/g' ./input.html.erb > ./index.html.erb
aws s3 cp ./index.html.erb s3://wca-regulations/history/official/${{ github.event.inputs.folder_name }}/index.html.erb --acl public-read
aws s3 cp s3://wca-regulations/guidelines.html.erb s3://wca-regulations/history/official/${{ github.event.inputs.folder_name }}/guidelines.html.erb --acl public-read
aws s3 cp s3://wca-regulations/wca-regulations-and-guidelines.pdf s3://wca-regulations/history/official/${{ github.event.inputs.folder_name }}/wca-regulations-and-guidelines.pdf --acl public-read
6 changes: 6 additions & 0 deletions .github/workflows/deploy-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ jobs:
# Update version
echo "$git_hash" > $outputdir/version
aws s3 sync $outputdir s3://wca-regulations/ --acl public-read
# Copy over the current latest version to history
date_str=$(cat $outputdir/index.html.erb | grep -oP 'Version: \K[A-Za-z]+ \d{1,2}, \d{4}')
formatted_date=$(date -d "$date_str" +"%Y-%m-%d")
aws s3 cp s3://wca-regulations/guidelines.html.erb s3://wca-regulations/history/official/$formatted_date/guidelines.html.erb --acl public-read
aws s3 cp s3://wca-regulations/wca-regulations-and-guidelines.pdf s3://wca-regulations/history/official/$formatted_date/wca-regulations-and-guidelines.pdf --acl public-read
aws s3 cp s3://wca-regulations/index.html.erb s3://wca-regulations/history/official/$formatted_date/index.html.erb --acl public-read
Loading