Skip to content

Merge pull request #9 from bcgov/fix/release #2

Merge pull request #9 from bcgov/fix/release

Merge pull request #9 from bcgov/fix/release #2

Workflow file for this run

name: Merge to Main
on:
push:
branches:
- main
paths-ignore:
- ".github/ISSUE_TEMPLATE/*"
- "**.md"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
codeql:
name: Semantic Code Analysis
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize
uses: github/codeql-action/init@v2
with:
languages: java
# Autobuild failed for Java, so building manually
- name: Set up JDK 17 and Caching maven dependencies
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"
- name: Build Core and Spring
run: |
cd core
mvn clean package
mvn install
cd ../spring
mvn clean package
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
release:
name: Release dependencies
outputs:
version: ${{ steps.changelog.outputs.version }}
needs:
- codeql
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"
- name: Conventional Changelog
uses: TriPSs/conventional-changelog-action@v3
id: changelog
continue-on-error: true
with:
github-token: ${{ github.token }}
output-file: "CHANGELOG.md"
skip-version-file: "true"
skip-commit: "true"
git-push: "false"
skip-on-empty: "false"
- name: Set version
run: |
cd core
mvn versions:set -DnewVersion='${{ steps.changelog.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit
cd ../spring
mvn versions:use-dep-version -DdepVersion=${{ steps.changelog.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn versions:set -DnewVersion='${{ steps.changelog.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit --file pom.xml
- name: Create Release
uses: softprops/action-gh-release@v1
if: ${{ steps.changelog.outputs.tag != '' }}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
with:
token: ${{ github.token }}
tag_name: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
release-core:
name: Build Core
runs-on: ubuntu-22.04
needs:
- release
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"
- uses: bcgov-nr/[email protected]
name: Core Coverage
with:
commands: |
mvn -B verify -P all-tests checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml
dir: core
java-cache: maven
java-distribution: temurin
java-version: "17"
sonar_args: >
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=bcgov_nr-forest-client-commons
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}
- name: Publish Core
working-directory: ./core
run: |
mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit
mvn -B source:jar deploy --file pom.xml
env:
GITHUB_TOKEN: ${{ github.token }}
release-spring:
name: Build Spring
runs-on: ubuntu-22.04
needs:
- release
- release-core
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
server-id: "github"
- uses: bcgov-nr/[email protected]
name: Spring Coverage
with:
commands: |
mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn -B verify -P all-tests checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml
dir: spring
java-cache: maven
java-distribution: temurin
java-version: "17"
sonar_args: >
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=bcgov_nr-forest-client-commons
sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }}
- name: Publish Spring
working-directory: ./spring
run: |
mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml
mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml
mvn versions:commit --file pom.xml
mvn -B source:jar deploy --file pom.xml
env:
GITHUB_TOKEN: ${{ github.token }}