CK4SME Final #18
Workflow file for this run
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
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
# or when the workflow is run maually. | |
# If a release is made, then the version of the package (also embedded in the NQ file) is set to the release tag. | |
# If the workflow is run manually then the version used is the branch name plus the ISO datetime string. | |
name: Gradle Package Domain Model | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Get csv2nq | |
uses: actions/checkout@v3 | |
with: | |
repository: SPYDERISK/domain-csv2nq | |
ref: main | |
path: ./csv2nq | |
- name: Set version | |
run: | | |
if [ ${GITHUB_EVENT_NAME} = 'workflow_dispatch' ]; then | |
echo "VERSION=${GITHUB_REF_NAME}-$(date +'%Y-%m-%dT%H:%M')" >> ${GITHUB_ENV} | |
else | |
# remove "v" from the release tag | |
echo "VERSION=${GITHUB_REF_NAME}" | sed 's/v//' >> ${GITHUB_ENV} | |
fi | |
echo "Environment is:" | |
cat ${GITHUB_ENV} | |
- name: Run csv2nq | |
run: | | |
cd ${GITHUB_WORKSPACE} | |
mkdir output | |
# the "domain.nq" filename is looked for when uploading a new domain model through the system-modeller web UI | |
python3 csv2nq/csv2nq.py -e -i csv -o output/domain.nq -m output/icon-mapping.json -v ${VERSION} | |
cp -a icons output/icons | |
cd output | |
zip -qr domain-model.zip * | |
- name: Publish to GitHub Packages | |
uses: gradle/[email protected] | |
with: | |
arguments: publish -PdomainModelArtifact=${{ github.workspace }}/output/domain-model.zip -PprojectVersion=${{ env.VERSION }} | |
gradle-version: 6.3 | |
env: | |
MAVEN_USER: ${{ github.actor }} | |
MAVEN_PASS: ${{ secrets.GITHUB_TOKEN }} |