Created
February 24, 2026 17:27
-
-
Save chapmanjacobd/bab8785b3f63ac33a054b1ddd5262c5d to your computer and use it in GitHub Desktop.
uploading to Internet Archive from GitHub Actions
This file contains hidden or 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: Upload to Internet Archive | |
| working-directory: nspawn-loop | |
| env: | |
| IA_ACCESS_KEY: ${{ secrets.IA_ACCESS_KEY }} | |
| IA_SECRET_KEY: ${{ secrets.IA_SECRET_KEY }} | |
| run: | | |
| set -euo pipefail | |
| pipx install internetarchive | |
| export PATH="$PATH:$HOME/.local/bin" | |
| # Configure IA credentials using S3 keys | |
| mkdir -p ~/.config | |
| printf "[s3]\naccess = %s\nsecret = %s\n" "$IA_ACCESS_KEY" "$IA_SECRET_KEY" > ~/.config/ia.ini | |
| chmod 600 ~/.config/ia.ini | |
| # Construct a stable identifier for "updating" (no dots allowed) | |
| # Format: iiab-raspios-edition (e.g., iiab-raspios-contentready) | |
| ID="iiab-raspios-$(echo "${{ matrix.edition }}" | tr '[:upper:]' '[:lower:]' | tr '.' '-' | tr '_' '-')" | |
| echo "Calculating hashes for $IMG_NAME..." | |
| IMG_SIZE=$(stat -c%s "$IMG_NAME") | |
| IMG_SHA256=$(sha256sum "$IMG_NAME" | awk '{print $1}') | |
| rm -f "$IMG_NAME" | |
| XZ_SIZE=$(stat -c%s "$IMG_NAME.xz") | |
| XZ_MD5=$(md5sum "$IMG_NAME.xz" | awk '{print $1}') | |
| echo "Deleting previous versions of $ID" | |
| ia delete "$ID" --all -H "x-archive-keep-old-version:0" || true | |
| echo "Uploading $IMG_NAME.xz to Internet Archive as item: $ID" | |
| ia upload "$ID" "$IMG_NAME.xz" \ | |
| --no-derive --verify --retries 3 --sleep 300 \ | |
| --metadata="mediatype:software" \ | |
| --metadata="collection:internetinabox" \ | |
| --metadata="title:Internet in a Box Raspberry Pi Image - ${{ matrix.edition }} (Latest)" \ | |
| --metadata="language:eng" \ | |
| --metadata="description:Internet in a Box $IIAB_BASE_VERSION Raspberry Pi Build<BR>Edition: ${{ matrix.edition }}<BR>Filename: $IMG_NAME<BR>Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ | |
| --metadata="creator:Internet in a Box" \ | |
| --metadata="subject:rpi" \ | |
| --metadata="subject:iiab" \ | |
| --metadata="subject:${{ matrix.edition }}" \ | |
| --metadata="licenseurl:http://creativecommons.org/licenses/by-sa/4.0/" \ | |
| --metadata="img_sha256:$IMG_SHA256" \ | |
| --metadata="img_size:$IMG_SIZE" \ | |
| --metadata="xz_size:$XZ_SIZE" \ | |
| --metadata="xz_md5:$XZ_MD5" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment