Skip to content

Mirror repository content to an S3 bucket #1573

Mirror repository content to an S3 bucket

Mirror repository content to an S3 bucket #1573

Workflow file for this run

name: Mirror repository content to an S3 bucket
on:
push:
branches:
- gh-pages
schedule:
# Pushes to `gh-pages` done from other actions cannot trigger this action so we also want it to run
# on a schedule. Let's give the nightly job a 1h head-start and run every day at 1:00.
- cron: '0 1 * * *'
env:
S3_BUCKET: solc-bin
S3_REGION: eu-central-1
CLOUDFRONT_DISTRIBUTION_ID: E1O6GT57WUFUHD
jobs:
push-to-s3:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Symlink solc-bin to /mnt/solc-bin
# It's now too big to fit on the main partition on Ubuntu, which is mostly filled with software.
run: |
sudo mkdir /mnt/solc-bin/
sudo chown "$USER" /mnt/solc-bin/
ln -s /mnt/solc-bin/ solc-bin
- name: Wait for other instances of this workflow to finish
# It's not safe to run two S3 sync operations concurrently with different files
uses: softprops/turnstyle@v1
with:
same-branch-only: no
poll-interval-seconds: 120 # in seconds
- name: Configure the S3 client
run: |
aws configure set default.region "$S3_REGION"
aws configure set aws_access_key_id '${{ secrets.AWS_ACCESS_KEY_ID }}'
aws configure set aws_secret_access_key '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: 'solc-bin'
- name: Render README.md to HTML
run: |
pip install markdown
cd solc-bin/
echo "<html><body>$(python -m markdown README.md)</body></html>" > README.html
- name: Sync the S3 bucket
run: |
cd solc-bin/
./sync-s3.sh "$S3_BUCKET" "$CLOUDFRONT_DISTRIBUTION_ID"