Skip to content

build: set ukis version 16.0.1-next.2 map pass view options #47

build: set ukis version 16.0.1-next.2 map pass view options

build: set ukis version 16.0.1-next.2 map pass view options #47

Workflow file for this run

# lint action on https://rhysd.github.io/actionlint/
name: Package Release (Main + Pre)
on:
# MAIN RELEASE: PRs with release-vX.Y.Z title on branches
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches: [main]
# PRE-RELEASE: tags like v1.2.3-next.1
push:
branches-ignore:
- "*"
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-next.[0-9]+'
permissions:
# REQUIRED for npm trusted publishing
id-token: write
contents: read
jobs:
# MAIN RELEASE JOBS (only run for PRs)
checkHeadBranch_pr:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
# check head (source) branch - Only for PRs
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-')
steps:
- run: echo "Run the jobs for the release pull_request"
# get the tag to release from the PR title
checkTitelTag_pr:
runs-on: ubuntu-latest
needs: checkHeadBranch_pr
if: github.event_name == 'pull_request' # Only for PRs
steps:
# - uses: actions/checkout@v6
# needs uses: actions/checkout@ if script/module is required
- name: checkTitelTag
uses: actions/github-script@v8
id: get-tag
with:
result-encoding: string
script: |
if (context.payload.pull_request && context.payload.pull_request.title) {
const title = context.payload.pull_request.title;
const parts = title.split('release-');
if (parts.length === 2) {
const versionTag = parts[1];
core.info(`title contains version ${versionTag}`);
if(versionTag.startsWith('v')){
return versionTag;
}else{
core.setFailed(`Your PR title does not follow the naming convention of the version with "release-v..." ${title}`)
}
} else {
core.setFailed(`Your PR title does not follow the naming convention "release-v[0-9]+.[0-9]+.[0-9]" ${title}`)
}
}else{
core.setFailed(`context.payload does not have a pull_request" ${context.payload}`)
}
- name: log output
run: echo "${{ steps.get-tag.outputs.result }}"
outputs:
VERSION_TAG: ${{ steps.get-tag.outputs.result }}
# SHARED JOBS (run for both PRs and tags) --------------------------------------------
# check if the tag is already published - uses @dlr-eoc/map-ol for test
checkTagOnNpm_pr:
runs-on: ubuntu-latest
needs: [checkHeadBranch_pr, checkTitelTag_pr]
if: github.event_name == 'pull_request' && needs.checkTitelTag_pr.outputs.VERSION_TAG != ''
steps:
- uses: actions/checkout@v6
- name: checkout tag
run: |
git fetch --all --tags
git checkout ${{ needs.checkTitelTag_pr.outputs.VERSION_TAG }}
- uses: actions/setup-node@v6
with:
node-version: 24
- run: rm -f .npmrc
- uses: ./.github/actions/check-tag-on-npm
with:
npmPackageName: "@dlr-eoc/map-ol"
tag: ${{ needs.checkTitelTag_pr.outputs.VERSION_TAG }}
build_pr:
needs: [checkHeadBranch_pr, checkTitelTag_pr, checkTagOnNpm_pr]
runs-on: ubuntu-latest
if: needs.checkTitelTag_pr.outputs.VERSION_TAG != ''
steps:
- uses: actions/checkout@v6
- name: checkout tag
run: |
git fetch --all --tags
git checkout ${{ needs.checkTitelTag_pr.outputs.VERSION_TAG }}
- uses: actions/setup-node@v6
with:
node-version: 24
- name: build
run: |
npm ci
npm run build
- name: Archive dist artifacts
uses: actions/upload-artifact@v4
with:
name: "dist"
path: dist
# if build works fine we can proceed, add a label and create the release
checkLabel_pr:
runs-on: ubuntu-latest
needs: [build_pr]
steps:
- name: checkLabel
uses: actions/github-script@v8
with:
script: |
if(context.payload.pull_request.labels){
const hasLabel = context.payload.pull_request.labels.find(i => i.name === 'RELEASE');
if(!hasLabel){
core.setFailed(`pull_request hasLabel 'RELEASE' === ${hasLabel}`)
}
}else{
core.setFailed(`context.payload does not have a pull_request" ${context.payload}`);
}
gh-release_pr:
runs-on: ubuntu-latest
needs: [build_pr, checkLabel_pr, checkTitelTag_pr]
permissions:
contents: write
actions: write
steps:
# Your existing gh-release logic, but dynamic tag:
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.checkTitelTag_pr.outputs.VERSION_TAG }}
# download artifacts and publish packages
publish-gpr_pr:
needs: [checkHeadBranch_pr, checkTitelTag_pr, checkTagOnNpm_pr, build_pr, checkLabel_pr, gh-release_pr]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Download dist result from job build
uses: actions/download-artifact@v4
with:
name: "dist"
path: dist
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://npm.pkg.github.com/
scope: "@dlr-eoc"
- run: npm ci
### update npm to >8.19 for publish https://github.com/npm/cli/issues/2453 https://github.com/npm/cli/issues/3573
- run: npm i -g npm@latest # Latest npm for trusted publishing
- name: Check if .npmrc is there and delete file if it exists
id: check_and_delete_npmrc
run: |
FILE_PATH=".npmrc"
if [ -f "$FILE_PATH" ]; then
echo "File exists: $FILE_PATH"
rm -f "$FILE_PATH"
echo "File deleted."
else
echo "File does not exist: $FILE_PATH"
fi
### for each module in dist update package.json and create .npmrc
- run: node scripts/library/index.js --update-package=https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
### for each module in dist publish frontend-libraries to registry
- run: |
for dir in ./dist/*/;
do
dir=${dir%*/}
npm publish "$dir" --access public --tag "latest"
done
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-npm_pr:
needs: [checkHeadBranch_pr, checkTitelTag_pr, checkTagOnNpm_pr, build_pr, checkLabel_pr, gh-release_pr]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download dist result from job build
uses: actions/download-artifact@v4
with:
name: "dist"
path: dist
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
scope: "@dlr-eoc"
- run: npm ci
### update npm to >8.19 for publish https://github.com/npm/cli/issues/2453 https://github.com/npm/cli/issues/3573
- run: npm i -g npm@latest # Latest npm for trusted publishing
- run: rm -f .npmrc
### for each module in dist update package.json and create .npmrc
- run: node scripts/library/index.js --update-package=https://registry.npmjs.org/
### for each module in dist publish frontend-libraries to registry
- run: |
for dir in ./dist/*/;
do
dir=${dir%*/}
npm publish "$dir" --access public --tag "latest" --provenance
done
env:
AUTH_TOKEN: ${{secrets.NPM_TOKEN_FROM_OIDC}}
# Pre RELEASE JOBS (only run for tags push) -------------------------------------------
checkTagOnNpm_push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
# check out before using actions reference from the same repository!
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: rm -f .npmrc
- uses: ./.github/actions/check-tag-on-npm
with:
npmPackageName: "@dlr-eoc/map-ol"
tag: "${{ github.ref }}"
build_push:
needs: [checkTagOnNpm_push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: ./.github/actions/test
- name: build
run: |
npm ci
npm run build
- name: Archive dist artifacts
uses: actions/upload-artifact@v4
with:
name: "dist"
path: dist
# create Release on tag push https://github.com/softprops/action-gh-release
gh-release_push:
needs: [build_push]
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Release
uses: softprops/action-gh-release@v2
with:
prerelease: true
publish-gpr_push:
needs: [gh-release_push, build_push]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Download dist result from job build
uses: actions/download-artifact@v4
with:
name: "dist"
path: dist
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://npm.pkg.github.com/
scope: "@dlr-eoc"
- run: npm ci
### update npm to >8.19 for publish https://github.com/npm/cli/issues/2453 https://github.com/npm/cli/issues/3573
- run: npm i -g npm@latest # Latest npm for trusted publishing
- name: Check if .npmrc is there and delete file if it exists
id: check_and_delete_npmrc
run: |
FILE_PATH=".npmrc"
if [ -f "$FILE_PATH" ]; then
echo "File exists: $FILE_PATH"
rm -f "$FILE_PATH"
echo "File deleted."
else
echo "File does not exist: $FILE_PATH"
fi
### for each module in dist update package.json and create .npmrc
- run: node scripts/library/index.js --update-package=https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
### for each module in dist publish frontend-libraries to registry
- run: |
# Pre-release: use tag next
for dir in ./dist/*/
do
dir=${dir%*/}
npm publish "$dir" --access public --tag "next"
done
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-npm_push:
needs: [gh-release_push, build_push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download dist result from job build
uses: actions/download-artifact@v4
with:
name: "dist"
path: dist
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
scope: "@dlr-eoc"
- run: npm ci
### update npm to >8.19 for publish https://github.com/npm/cli/issues/2453 https://github.com/npm/cli/issues/3573
- run: npm i -g npm@latest # Latest npm for trusted publishing
- run: rm -f .npmrc
### for each module in dist update package.json and create .npmrc
- run: node scripts/library/index.js --update-package=https://registry.npmjs.org/
### for each module in dist publish frontend-libraries to registry
- run: |
# Pre-release: use tag next
for dir in ./dist/*/
do
dir=${dir%*/}
npm publish "$dir" --access public --tag "next" --provenance
done
env:
AUTH_TOKEN: ${{secrets.NPM_TOKEN_FROM_OIDC}}