Skip to content

Auxiliary & Access file download #13

Auxiliary & Access file download

Auxiliary & Access file download #13

Workflow file for this run

name: Generate typescript and push to nulib/dcapi-types@staging
on:
pull_request_target:
types:
- closed
branches:
- "deploy/staging"
paths:
- "docs/docs/spec/data-types.yaml"
- ".github/flags/deploy-data-types"
workflow_dispatch:
jobs:
Push-To-Types-Repo-Staging:
if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: staging
env:
TARGET_BRANCH: "staging"
TMP_SRCDIR: "./source"
TMP_DSTDIR: "./dest"
TYPES_REPO: "nulib/dcapi-types"
steps:
- run: |
echo PR with changes to datatypes.yml was merged into staging
- name: Checkout dc-api-v2
uses: actions/checkout@v3
with:
path: "${{ env.TMP_SRCDIR }}"
- uses: actions/setup-node@v3
with:
cache-dependency-path: "${{ env.TMP_SRCDIR }}/node/package-lock.json"
node-version: 16.x
cache: "npm"
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: "${{ env.TMP_SRCDIR }}/node"
- name: Generate Typescript file
working-directory: "${{ env.TMP_SRCDIR }}/node"
run: |
npm ci
npx openapi-typescript ../docs/docs/spec/data-types.yaml --output schemas.ts
- name: Checkout dcapi-types
uses: actions/checkout@v3
with:
path: ${{ env.TMP_DSTDIR }}
ref: ${{ env.TARGET_BRANCH }}
repository: ${{env.TYPES_REPO}}
- run: mv -f "${{ env.TMP_SRCDIR }}/node/schemas.ts" "${{ env.TMP_DSTDIR }}/schemas.ts"
shell: bash
- name: Set GitHub Deploy Key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.DCAPI_TYPES_DEPLOY_KEY }}
- working-directory: "${{ env.TMP_DSTDIR }}"
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit -m "nulib/dc-api-v2 commit: $GITHUB_SHA, package.json version: ${{ steps.package-version.outputs.current-version}}"
git push origin HEAD
shell: bash