Standard Build #1572
This file contains 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: Standard Build | |
on: | |
schedule: | |
# m h d M wd(MON-SUN) | |
- cron: "0 12 * * *" | |
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 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-v5-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2-v5- | |
- name: Build | |
env: | |
NEW_RELEASE_VER: ${{ github.event.inputs.NEW_RELEASE_VER }} | |
NEW_SNAPSHOT_VER: ${{ github.event.inputs.NEW_SNAPSHOT_VER }} | |
KNET_REPO_USER: ${{secrets.KNET_REPO_USER}} | |
KNET_REPO_PASSWORD: ${{secrets.KNET_REPO_PASSWORD}} | |
# TODO: Replacing the old secrets.GIT_USER, to be tested and the old secret to be | |
# removed | |
GIT_USER: ${{github.actor}} | |
# TODO: replacing the old github.token, remove this note after testing | |
GIT_PASSWORD: ${{secrets.GITHUB_TOKEN}} | |
GIT_USER_EMAIL: ${{secrets.GIT_USER_EMAIL}} | |
CI_TRIGGERING_EVENT: ${{ github.event_name }} | |
# If you use on: schedule:, this will tell build.sh how often you try to trigger a build | |
# It uses it to know if there are git changes since the last scheduled build | |
CI_SCHEDULE_PERIOD: 24 # hours | |
KNET_JENKINS_USER: ${{secrets.KNET_JENKINS_USER}} | |
KNET_JENKINS_TOKEN: ${{secrets.KNET_JENKINS_TOKEN}} | |
# TODO: remove (from the settings too), were used with the Docker registry | |
#DOCKER_USER: ${{secrets.DOCKER_USER}} | |
#DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
# Used to notify events like build failures | |
CI_SLACK_API_NOTIFICATION_URL: ${{secrets.CI_SLACK_API_NOTIFICATION_URL}} | |
run: | | |
mkdir -p ci-build | |
export CI_DIR_URL="https://raw.githubusercontent.com/Rothamsted/knetminer-common/master/ci-build" | |
wget "$CI_DIR_URL/install.sh" -O ci-build/install.sh | |
bash ./ci-build/install.sh | |
bash ./ci-build/build.sh |