Skip to content

Update build-and-deploy.yml #1122

Update build-and-deploy.yml

Update build-and-deploy.yml #1122

name: CI/CD Process
on:
workflow_call:
workflow_dispatch:
jobs:
compute-java-range:
runs-on: ubuntu-22.04
outputs:
java-range: ${{ steps.range.outputs.java-range }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Compute range
id: range
run: .github/compute-java-range.rb >> "$GITHUB_OUTPUT"
- name: Show result
run: echo "java-range=${{ steps.range.outputs.java-range }}"
build:
needs:
- compute-java-range
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-12, ubuntu-22.04]
jvm_version: ${{ fromJson(needs.compute-java-range.outputs.java-range) }}
distribution: [ temurin ]
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-build-${{ matrix }}-${{ github.event.number || github.ref }}
runs-on: ${{ matrix.os }}-latest
env:
JAVA_VERSION: ${{ matrix.jvm_version }}
OS: ${{ matrix.os }}
TERM: dumb
steps:
# Checkout the repository
- name: Debug: print the concurrency group

Check failure on line 40 in .github/workflows/build-and-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-and-deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 40
run: echo "${{ github.workflow }}-build-${{ matrix }}-${{ github.event.number || github.ref }}"
- name: Checkout
uses: danysk/[email protected]
with:
token: ${{ secrets.DEPLOYMENT_TOKEN }}
- name: Compute the version of Maven
id: maven
shell: bash
run: |
# Idea: the regex matcher of Renovate keeps this string up to date automatically
# The version is extracted and used to access the correct version of the scripts
USES=$(cat <<TRICK_RENOVATE
- uses: apache/[email protected]
TRICK_RENOVATE
)
echo "Scripts update line: \"$USES\""
echo "Computed version: \"${USES#*@v}\""
echo "{version}={${USES#*@v}}" >> $GITHUB_OUTPUT
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: ${{ steps.maven.outputs.version }}
- name: Find the version of Node from package.json
if: matrix.jvm_version == 11 && contains('Linux', runner.os)
id: node-version
run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT
- name: Install Node
if: matrix.jvm_version == 11 && contains('Linux', runner.os)
uses: actions/[email protected]
with:
node-version: ${{ steps.node-version.outputs.version }}
- name: Checkout the update site
if: matrix.jvm_version == 11 && contains('Linux', runner.os)
uses: actions/[email protected]
with:
path: update-site
fetch-depth: 0
persist-credentials: true
repository: Protelis/update-site
token: ${{ secrets.DEPLOYMENT_TOKEN }}
- uses: DanySK/[email protected]
with:
build-command: |
COMMAND="mvn package -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -q"
eval $COMMAND || eval $COMMAND || eval $COMMAND
check-command: |
COMMAND="mvn test -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -q"
eval $COMMAND || eval $COMMAND || eval $COMMAND
deploy-command: |
echo '${{ secrets.SIGNING_KEY }}' > key.asc
gpg --import key.asc
rm key.asc
COMMAND="mvn deploy nexus-staging:drop -B -Dmaven.test.skip=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -q"
eval $COMMAND || eval $COMMAND || eval $COMMAND
npm install
npx semantic-release
java-distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.jvm_version }}
should-run-codecov: false
should-deploy: >-
${{
matrix.jvm_version == 11
&& matrix.os == 'ubuntu'
&& !github.event.repository.fork
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
}}
should-validate-wrapper: false
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
success:
runs-on: ubuntu-22.04
needs:
- build
- compute-java-range
if: >-
always() && (
contains(join(needs.*.result, ','), 'failure')
|| !contains(join(needs.*.result, ','), 'cancelled')
)
steps:
- name: Verify that there were no failures
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}