Skip to content

Commit

Permalink
wip - resource indexer github action
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Nov 3, 2023
1 parent d10c484 commit ea51b50
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/resource-indexer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: rebuild the resource collection index

on:
# Run at ~4am UTC time which is (± an hour) 4am UK, 5am Switzerland, midnight
# US east coast, 9pm US west coast so that for most users (and most
# developers) the index regenerates overnight
schedule:
- cron: '* 4 * * *'

# Manually triggered using GitHub's UI
workflow_dispatch:

jobs:
rebuild-index:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm ci
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::XXX:role/GitHubActionsRoleResourceIndexer
credential-lifetime: 3600 # seconds, or 1 hour, which is currently the default and should be plenty
- name: Rebuild the index
run: |
node resourceIndexer/main.js \
--gzip --output resources.json.gz
- name: Make a backup of the existing (current) index so that we can restore if needed
# AWS cli should be available on GitHub actions - to check
run: |
aws s3 cp s3://nextstrain-inventories/resources.json.gz s3://nextstrain-inventories/resources.json.gz.backup
- name: Upload the new index, overwriting the previous one
run: |
aws s3 cp resources.json.gz s3://nextstrain-inventories/resources.json.gz

0 comments on commit ea51b50

Please sign in to comment.