add optional dep for linux rollup #39
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: Release Assembly | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: client/package-lock.json | |
- name: Clean with Maven | |
run: mvn clean | |
- name: Build client | |
run: | | |
cd client | |
npm ci | |
npm run build | |
cd .. | |
- name: Compile with Maven | |
run: mvn compile | |
- name: Package with Maven | |
run: mvn package | |
- name: Get version and set release info | |
id: get_version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
echo "TAG_NAME=v$VERSION" >> $GITHUB_OUTPUT | |
echo "RELEASE_NAME=Release $VERSION" >> $GITHUB_OUTPUT | |
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT | |
else | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
TIMESTAMP=$(date +'%Y%m%d%H%M%S') | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
echo "TAG_NAME=v$VERSION-$COMMIT_HASH-$TIMESTAMP" >> $GITHUB_OUTPUT | |
echo "RELEASE_NAME=Release $VERSION ($(date +'%Y-%m-%d %H:%M:%S'))" >> $GITHUB_OUTPUT | |
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT | |
fi | |
- name: List target directory | |
run: ls -l target/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_version.outputs.TAG_NAME }} | |
release_name: ${{ steps.get_version.outputs.RELEASE_NAME }} | |
draft: false | |
prerelease: ${{ steps.get_version.outputs.IS_PRERELEASE }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/server-${{ steps.get_version.outputs.VERSION }}-oscal-server.zip | |
asset_name: oscal-server-${{ steps.get_version.outputs.VERSION }}.zip | |
asset_content_type: application/zip |