-
Notifications
You must be signed in to change notification settings - Fork 409
55 lines (45 loc) · 1.82 KB
/
s3-mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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: Remove unused software to free up space
run: |
# These are quick to delete and large enough to make a difference
rm -rf /usr/share/swift/ # 1.3 GB in 80 subdirs
rm -rf /usr/local/lib/android/sdk/build-tools/ # 2.1 GB in 450 subdirs
rm -rf /usr/share/dotnet/shared/ # 5.3 GB in 350 subdirs
rm -rf /usr/local/lib/android/sdk/ndk/ # 7.6 GB in 1500 subdirs
- 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
- 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@v3
with:
fetch-depth: 0
- name: Render README.md to HTML
run: |
pip install markdown
echo "<html><body>$(python -m markdown README.md)</body></html>" > README.html
- name: Sync the S3 bucket
run: |
./sync-s3.sh "$S3_BUCKET" "$CLOUDFRONT_DISTRIBUTION_ID"