Publish update manifest #2
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: Publish update manifest | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'release/latest.json' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Validate schema | |
| run: | | |
| jq -e ' | |
| .schema == 1 | |
| and (.latest.version | type == "string") | |
| and (.latest.released_at | type == "string") | |
| and (.latest.release_url | type == "string") | |
| and (.channels.stable | type == "string") | |
| and (.message.level | IN("info", "warn")) | |
| and (.message.text | type == "string") | |
| and (.announcements | type == "array") | |
| and (.announcements | all( | |
| .id and (.id | type == "string") | |
| and .level and (.level | IN("info", "warn", "critical")) | |
| and .title and (.title | type == "string") | |
| and .text and (.text | type == "string") | |
| )) | |
| ' release/latest.json | |
| - name: Install AWS CLI | |
| run: | | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip -q awscliv2.zip | |
| sudo ./aws/install --update | |
| aws --version | |
| - name: Upload to Cloudflare R2 | |
| env: | |
| R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} | |
| R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
| run: | | |
| export AWS_ACCESS_KEY_ID="${R2_ACCESS_KEY_ID}" | |
| export AWS_SECRET_ACCESS_KEY="${R2_SECRET_ACCESS_KEY}" | |
| R2_ENDPOINT="https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com" | |
| aws s3 cp release/latest.json \ | |
| s3://code-pathfinder-assets/pathfinder/latest.json \ | |
| --endpoint-url "$R2_ENDPOINT" \ | |
| --cache-control "public, max-age=300" \ | |
| --content-type "application/json" | |
| - name: Verify upload | |
| run: | | |
| curl -fsSL "https://assets.codepathfinder.dev/pathfinder/latest.json" \ | |
| | jq -e '.schema == 1' > /dev/null |