Generate packages.element.io directory indexes #2001
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: Generate packages.element.io directory indexes | |
on: | |
# Trigger a rebuild of all indexes if the template gets updated | |
push: | |
branches: [master] | |
paths: | |
- "packages.element.io/**" | |
# Trigger after reprepro deploys | |
workflow_run: | |
workflows: ["Deploy Reprepro"] | |
types: | |
- completed | |
# Remote API trigger for non-deb packages to hit | |
repository_dispatch: | |
types: [packages-index] | |
# Manual trigger | |
workflow_dispatch: {} | |
concurrency: ${{ github.workflow }} | |
jobs: | |
deploy: | |
name: "Deploy" | |
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' | |
runs-on: ubuntu-latest | |
environment: packages.element.io | |
env: | |
R2_BUCKET: ${{ vars.R2_BUCKET }} | |
R2_URL: ${{ vars.CF_R2_S3_API }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: "yarn" | |
- name: Install Deps | |
run: "yarn install --pure-lockfile" | |
- name: Copy static files | |
if: github.event_name == 'push' | |
run: aws s3 cp --recursive packages.element.io/ "s3://$R2_BUCKET/" --endpoint-url "$R2_URL" --region auto | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }} | |
- name: Generate directory indexes | |
run: scripts/generate-packages-index.ts | |
env: | |
CF_R2_S3_API: ${{ vars.CF_R2_S3_API }} | |
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} | |
CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }} |