Build #6
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
name: "Build" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '45 4 * * 5' # At 04:45 on Friday | |
env: | |
AWS_REGION : "us-east-1" | |
AWS_ROLE: ${{ secrets.AWS_ROLE }} | |
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
R2_API_ENDPOINT: ${{ secrets.R2_API_ENDPOINT }} | |
jobs: | |
website: | |
name: Website | |
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md | |
runs-on: ubuntu-latest | |
# Add "id-token" for AWS authentication | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
steps: | |
- name: 🐧 Install dependencies | |
run: | | |
sudo apt-get install \ | |
libdbd-sqlite3-perl \ | |
libjson-xs-perl \ | |
libtemplate-perl \ | |
libtext-csv-perl \ | |
rclone \ | |
sqlite3 | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v4 | |
# Configure AWS Credentials for GitHub Actions | |
# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions | |
- id: auth | |
name: 🔐 Authenticate to AWS | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ env.AWS_ROLE }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: 🔨 Run build script | |
run: | | |
cd build || exit 9 | |
bash build.sh || exit 9 | |
- name: 📑 Create website | |
run: | | |
cd build || exit 9 | |
perl web.pl || exit 9 | |
- name: 🧪 Tests | |
run: | | |
cat "web/eu-central-1.html" | grep "Frankfurt" || exit 9 | |
jq -e '.[] | .instanceType' "web/instances-locations.json" | grep "t3.medium" || exit 9 | |
- name: 🪣 Publish website | |
run: | | |
mkdir -p "$HOME/.config/rclone" || exit 9 | |
echo "[r2]" > "$HOME/.config/rclone/rclone.conf" || exit 9 | |
echo "type = s3" >> "$HOME/.config/rclone/rclone.conf" | |
echo "provider = Cloudflare" >> "$HOME/.config/rclone/rclone.conf" | |
echo "access_key_id = $R2_ACCESS_KEY_ID" >> "$HOME/.config/rclone/rclone.conf" | |
echo "secret_access_key = $R2_SECRET_ACCESS_KEY" >> "$HOME/.config/rclone/rclone.conf" | |
echo "endpoint = $R2_API_ENDPOINT" >> "$HOME/.config/rclone/rclone.conf" | |
echo "acl = private" >> "$HOME/.config/rclone/rclone.conf" | |
echo "no_check_bucket = true" >> "$HOME/.config/rclone/rclone.conf" | |
rclone copy --transfers 32 --checkers 64 --fast-list "web/" "r2:aws-pricing/" || exit 9 |