Files
default/.github/workflows/upload-removed.yml
T
dependabot[bot] ac3c0736cf Bump actions/checkout from 5.0.0 to 6.0.0 (#4721)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5.0.0...v6.0.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 08:39:31 +01:00

82 lines
2.5 KiB
YAML

name: Upload removed file to R2
on:
workflow_dispatch:
push:
branches:
- master
paths:
- removed
permissions: {}
concurrency:
cancel-in-progress: true
group: upload-removed
jobs:
upload:
runs-on: ubuntu-latest
name: Upload
steps:
- name: Checkout the repository
uses: actions/checkout@v6.0.0
- name: Validate with JSON schema
uses: cardinalby/schema-validator-action@3.1.1
with:
file: 'removed'
schema: 'tools/jsonschema/removed.schema.json'
- name: Set up Python
uses: actions/setup-python@v6.0.0
id: python
with:
python-version: "3.x"
- name: Install AWS CLI
run: |
pip3 install \
--disable-pip-version-check \
--ignore-installed \
awscli==1.36.39
- name: Handle the removed file
run: |
mkdir -p upload/removed
jq -c . < removed > upload/removed/data.json
jq -c '[.[].repository]' < removed > upload/removed/repositories.json
- name: Upload artifacts
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: removed
path: upload/removed
if-no-files-found: error
- name: Upload to R2
run: |
aws s3 sync \
upload/removed \
s3://data-v2/removed \
--endpoint-url ${{ secrets.CF_R2_ENDPOINT_DATA }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
- name: Bust Cloudflare cache
run: |
curl --silent --show-error --fail -X POST \
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CF_BUST_CACHE_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"files": ["https:\/\/data-v2.hacs.xyz\/removed\/data.json", "https:\/\/data-v2.hacs.xyz\/removed\/repositories.json"]}'
- name: Discord notification
if: ${{ github.event_name == 'schedule' && failure() }}
run: |
curl \
-H "Content-Type: application/json" \
-d '{"username": "GitHub action failure", "content": "[Scheduled action failed!](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"}' \
${{ secrets.DISCORD_WEBHOOK_ACTION_FAILURE }}