Filter unknown process definitions received via kafka #74 #603
Workflow file for this run
This file contains hidden or 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: Publish to GitHub Packages | |
| on: | |
| push: | |
| branches-ignore: | |
| - 'renovate/**' | |
| - 'release/**' | |
| - 'feature/wip-**' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-java@v3 | |
| with: | |
| java-version: 17 | |
| distribution: adopt | |
| cache: maven | |
| - name: Configure npm authentication for GitHub Packages | |
| run: | | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc | |
| echo "@vanillabp:registry=https://npm.pkg.github.com/" >> ~/.npmrc | |
| echo "always-auth=true" >> ~/.npmrc | |
| - id: get-version | |
| name: Read Maven pom.xml version | |
| uses: jactions/[email protected] | |
| - id: get-package-id | |
| name: Retrieve last package ID of NPM package bc-official-gui-client for calculating next ID | |
| # use first NPM package published as part of this pipeline (bc-official-gui-client) to determine new NPM prerelease id | |
| run: | | |
| VERSIONS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -L 'https://api.github.com/orgs/vanillabp/packages/npm/bc-official-gui-client/versions?per_page=100') | |
| ID=$(echo $VERSIONS | jq --exit-status ' ( [.[] | select(.name | startswith("${{ steps.get-version.outputs.version }}.") ) | .name["${{ steps.get-version.outputs.version }}." | length:]][0] // "-1" | tonumber ) +1 ') | |
| echo "PACKAGE_ID=${ID:-not-found}" >> $GITHUB_ENV | |
| echo "Next NPM prerelease version: $ID" | |
| - name: Publish package | |
| run: | | |
| mvn --batch-mode -s $GITHUB_WORKSPACE/.github/workflows/github-packages-settings.xml \ | |
| ${{ contains(steps.get-version.outputs.version, '-SNAPSHOT') && '' || format('-Dnpm.prerelease={0}', env.PACKAGE_ID) }} \ | |
| -Dnpm.registry=https://npm.pkg.github.com/ \ | |
| deploy | |
| env: | |
| USER_NAME: ${{ secrets.VANILLABP_USER_NAME }} | |
| USER_TOKEN: ${{ secrets.VANILLABP_USER_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - id: cleanup-outdated-npm-packages | |
| name: Delete outdated NPM packages | |
| run: | | |
| packages="bc-official-gui-client bc-shared bc-dev-shell-angular bc-dev-shell-react bc-ui" | |
| for p in $packages; do | |
| VERSIONS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -L "https://api.github.com/orgs/vanillabp/packages/npm/${p}/versions?per_page=100") | |
| TOBEDELETED=$(echo $VERSIONS | jq -r --exit-status ' ( [.[] | select(.name | startswith("${{ steps.get-version.outputs.version }}.") ) ] | sort_by(.id) )[:-5] | map(.id) | join(" ") ') | |
| for v in ${TOBEDELETED}; do | |
| curl -s -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -L "https://api.github.com/orgs/vanillabp/packages/npm/${p}/versions/$v" | |
| done | |
| done |