Skip to content

fix: add necessary variable to the GHA workflow #287

fix: add necessary variable to the GHA workflow

fix: add necessary variable to the GHA workflow #287

Workflow file for this run

# The GitHub Actions file
name: Standard Build
on:
push:
workflow_dispatch:
inputs:
# These can be set when the build is invoked manually, from GH Actions.
#
# Set BOTH when you want to trigger a new release. The build script will
# switch Maven to the new release, deploy, tag git, move Maven to the new snapshot
#
NEW_RELEASE_VER:
description: "New Release Version"
required: false
NEW_SNAPSHOT_VER:
description: "New Snapshot Version"
required: false
IS_LATEST_RELEASE:
description: "When releasing, tells if it's a github latest release. Ignored otherwise."
required: false
default: "true"
IS_PRE_RELEASE:
description: "When releasing, tells if it's a github pre-release. Ignored otherwise."
required: false
default: "false"
permissions:
# needed to push and when the repo belongs to an organisation.
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 21
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Cache Maven packages
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Avoids re-listing all the secrets again. As they recommend, use the commit hash to point to
# an exact version, using tags might be compromised by malicious commits.
#
# See knetminer-ci docs for a list of secrets and other variables we use.
#
- name: Forward all GH secrets to env
uses: oNaiPs/secrets-to-env-action@75f319b3c8c926ac2eabcca34daa6cf531daf32f
with:
secrets: ${{ toJSON(secrets) }}
- name: Build
# You still need this for variables that aren't secrets, but better than nothing
# See the kntminer-ci docs for details.
env:
GIT_USER: ${{github.actor}}
CI_NEW_RELEASE_VER: ${{github.event.inputs.NEW_RELEASE_VER}}
CI_NEW_SNAPSHOT_VER: ${{github.event.inputs.NEW_SNAPSHOT_VER}}
CI_TRIGGERING_EVENT: ${{github.event_name}}
GH_TOKEN: ${{ github.token }}
GIT_PASSWORD: ${{github.GITHUB_TOKEN}}
# We reuse the general CI scripts in knetminer-common, see https://github.com/KnetMiner/knetminer-ci
run:
./ci-build-v2/java-maven/build.sh