Merge pull request #555 from NDLANO/grep-indexing #823
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 typescript types' | |
on: | |
workflow_dispatch: | |
inputs: { } | |
push: | |
branches: | |
- master | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_CLIENT_ID }} | |
AWS_DEFAULT_REGION: eu-west-1 | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_CLIENT_SECRET }} | |
NDLA_AWS_ECR_REPO: ${{ secrets.NDLA_AWS_ECR_REPO }} | |
CI_RELEASE_ROLE: ${{ secrets.CI_RELEASE_ROLE }} | |
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | |
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
NDLA_RELEASES: ${{ secrets.NDLA_RELEASES }} | |
KNOWIT_EMAIL: ${{ secrets.KNOWIT_EMAIL }} | |
jobs: | |
generate_typescript: | |
name: Generate typescript types | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.CI_GITHUB_TOKEN }} | |
- uses: coursier/cache-action@v6 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: '20' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.12' | |
- name: Login to ECR repo | |
run: RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name | |
github-actions-ecr-login) AWS_ACCESS_KEY_ID=$(echo $RES | jq -r .Credentials.AccessKeyId) | |
AWS_SECRET_ACCESS_KEY=$(echo $RES | jq -r .Credentials.SecretAccessKey) AWS_SESSION_TOKEN=$(echo | |
$RES | jq -r .Credentials.SessionToken) aws ecr get-login-password --region | |
eu-central-1 | docker login --username AWS --password-stdin $NDLA_AWS_ECR_REPO | |
- name: Login to dockerhub | |
run: echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME | |
--password-stdin | |
- name: Generate typescript types | |
run: sbt generateTypescript | |
- name: Verify typescript types | |
run: cd typescript/types-backend && yarn install && yarn tsc | |
- name: Verify typescript constants | |
run: cd typescript/constants-backend && yarn install && yarn tsc | |
- name: Commit typescript changes | |
continue-on-error: true | |
run: | | |
git config user.email "$KNOWIT_EMAIL" | |
git config user.name "github-actions" | |
git add typescript/* | |
git commit -m "AUTOMATION: Generated new typescript files" | |
git push |