Skip to content

Commit

Permalink
update build to use GH actions, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
electricsam committed Dec 19, 2024
1 parent 06c538c commit 1b018b0
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 116 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/branch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: maven branch release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: build with maven
run: |
mvn -B -s settings.xml \
build-helper:parse-version \
-DbranchName='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}' \
-DdevelopmentVersion='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT' \
release:branch
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
ARTIFACTORY_API_USERNAME: ${{ vars.ARTIFACTORY_API_USERNAME }}
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
ARTIFACTORY_SNAPSHOT_URL: ${{ vars.ARTIFACTORY_SNAPSHOT_URL }}
ARTIFACTORY_RELEASE_URL: ${{ vars.ARTIFACTORY_RELEASE_URL }}
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: maven build

on:
push:
branches: [ "**" ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: build with maven
run: mvn -B -s settings.xml clean deploy -Pdep-check
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
ARTIFACTORY_API_USERNAME: ${{ vars.ARTIFACTORY_API_USERNAME }}
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
ARTIFACTORY_SNAPSHOT_URL: ${{ vars.ARTIFACTORY_SNAPSHOT_URL }}
ARTIFACTORY_RELEASE_URL: ${{ vars.ARTIFACTORY_RELEASE_URL }}
- name: notify dependencies
run: |
set -ex
mvn dependency:list | grep 'SNAPSHOT:compile' > dependencies.txt || true
mvn -q -Dexec.executable='echo' -Dexec.args='${project.groupId}:${project.artifactId}:${project.packaging}:${project.version}' exec:exec | grep :jar: > artifacts.txt
echo "{\"event_type\":\"update-dependencies\",\"client_payload\":{\"project\":\"${{ github.event.repository.name }}:${{ github.head_ref || github.ref_name }}\",\"artifacts\":\"$( cat artifacts.txt | awk -v ORS='\\n' '1' )\",\"dependencies\":\"$( cat dependencies.txt | awk -v ORS='\\n' '1' )\"}}" > dependency-action.json
curl -n "https://api.github.com/repos/CI-CMG/maven-dependency-build/dispatches" \
--header 'Accept: application/vnd.github+json' \
--header "Authorization: token ${{ secrets.RELEASE_PAT }}" \
--data @dependency-action.json
72 changes: 0 additions & 72 deletions .github/workflows/codeql.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: maven tag release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: set up git
run: git config --global user.email [email protected] && git config --global user.name 'Bloopy McBloopFace'
- name: build with maven
run: |
mvn -B -s settings.xml \
build-helper:parse-version \
-Dresume=false -Dtag='v${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}' \
-DreleaseVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}' \
-DdevelopmentVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT' \
release:prepare release:perform
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
ARTIFACTORY_API_USERNAME: ${{ vars.ARTIFACTORY_API_USERNAME }}
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
ARTIFACTORY_SNAPSHOT_URL: ${{ vars.ARTIFACTORY_SNAPSHOT_URL }}
ARTIFACTORY_RELEASE_URL: ${{ vars.ARTIFACTORY_RELEASE_URL }}
Loading

0 comments on commit 1b018b0

Please sign in to comment.