Skip to content

173 flat env vars #1642

173 flat env vars

173 flat env vars #1642

Workflow file for this run

name: build plugin
on:
workflow_dispatch:
inputs:
GIT_REPO_FULL_NAME:
description: Select RepoName
required: false
type: choice
options:
- data2evidence/d2e
GIT_BRANCH_NAME:
default: develop
description: Enter BranchName / ReleaseTagName
required: true
type: string
tag:
description: Enter tag for release
required: true
type: string
release:
description: Enter name for github release
required: true
type: string
prerelease:
type: boolean
default: true
required: true
overwrite:
type: boolean
default: true
required: true
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop
env:
GIT_BRANCH_NAME: ${{ github.event.inputs.GIT_BRANCH_NAME || github.head_ref || github.ref_name }} # workflow_dispatch || pull_request || push
GIT_REPO_FULL_NAME: ${{ github.event.inputs.GIT_REPO_FULL_NAME || github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} # workflow_dispatch || pull_request || push
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- PKGPATH: ./functions/
DESTPATH: /usr/src/data/plugins/node_modules/@data2evidence/d2e-functions
- PKGPATH: ./fhir_functions/
DESTPATH: /usr/src/data/plugins/node_modules/@data2evidence/fhir
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH_NAME }}
repository: ${{ env.GIT_REPO_FULL_NAME }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://npm.pkg.github.com"
scope: "@data2evidence"
- name: Prepare
working-directory: ${{ matrix.PKGPATH }}
run: |
if [[ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]]; then
RELEASE_VERSION=${{ github.event.inputs.tag }}
jq --arg v $RELEASE_VERSION '.version=$v' package.json > tmppkg; mv tmppkg package.json
else
jq --arg v "-$(date +%s)-$GITHUB_SHA" '.version+=$v' package.json > tmppkg; mv tmppkg package.json
fi
cp package.json package.org.json
sudo mkdir -p ${{ matrix.DESTPATH }}
sudo chown runner:docker ${{ matrix.DESTPATH }}
- name: npminstall
working-directory: ${{ matrix.PKGPATH }}
run: |
npm install
cp -a . ${{ matrix.DESTPATH }}
env:
NODE_AUTH_TOKEN: ${{ secrets.PH_TOKEN }}
- name: npm build
working-directory: ${{ matrix.DESTPATH }}
run: npm run build
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/d2e/npm/registry/"
scope: "@data2evidence"
- name: Publish
working-directory: ${{ matrix.DESTPATH }}
env:
SHOULD_PUBLISH: ${{ github.ref_name == 'develop' || github.event_name == 'workflow_dispatch' }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ $SHOULD_PUBLISH == true ]]; then
npm publish
else
npm publish --dry-run
fi