Skip to content

Update AWS IAM data #316

Update AWS IAM data

Update AWS IAM data #316

Workflow file for this run

name: Update AWS IAM data
on:
workflow_dispatch:
schedule:
# Run everyday at 4AM UTC
- cron: '0 4 * * *'
jobs:
gather_and_update_iam_data:
name: Gather the latest AWS IAM data and if there is new data, publish a new package version to npm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Gather data and check for changes
id: gatherData
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Install dependencies
npm i
# Copy old IAM data for changelog comparison
cp data/json/iam.json data/json/iam.old.json
# Gather data
npm run gather-data
# Setup git repo
git config --global user.name 'TobiLG'
git config --global user.email 'tobilg@users.noreply.github.com'
git remote set-url --push origin https://tobilg:$GITHUB_TOKEN@github.com/tobilg/aws-iam-data
# Add new files if there are any
git add .
# Check for changes and commit if there are any
git diff-index --cached --quiet HEAD || echo '::set-output name=changed::true'
- name: Eventually publish new package version
if: ${{ steps.gatherData.outputs.changed == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Increase package patch version \
npm --no-git-tag-version version patch && \
# Update changelog \
npm run update-changelog && \
# Install DuckDB \
npm run install-duckdb && \
# Create tables \
npm run create-tables && \
# Export data \
npm run export-data && \
# Create reports \
npm run create-reports && \
# Add new files \
git add . && \
# Commit changes \
git commit -am "[no ci] Data update on $(date '+%FT%H:%M:%S')" && \
# Push to repo \
git push && \
# Build package sources \
npm run build && \
# Publish new version to npm registry \
npm publish