From ae4cd20b366c62f81414e9988882772b355d9b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Thu, 21 Mar 2024 13:31:28 +0100 Subject: [PATCH] ci: add release workflow --- .github/workflows/build.yml | 19 ++++++++++------- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ .github/workflows/shacl.yml | 6 +++--- .gitignore | 1 + scripts/combine | 1 + 5 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90ae6ef..579405b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,11 @@ name: build - + on: workflow_dispatch: push: branches: - master - + jobs: build: runs-on: ubuntu-latest @@ -14,9 +14,14 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies - run: | - sudo apt-get install -y raptor2-utils - pip install pyshacl + run: sudo apt-get install -y raptor2-utils + + - name: Build + run: source ./scripts/combine - - name: Build and Validate - run: ./scripts/shacl + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: dist + folder: dist + single-commit: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..52418a4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release +on: + push: + tags: '[2-9][0-9]\.[0-9][0-9]' +jobs: + create-release: + name: Create release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create-release.outputs.upload_url }} + steps: + - name: Build Changelog + id: build-changelog + uses: mikepenz/release-changelog-builder-action@v4 + with: + commitMode: true + configurationJson: | + { + "pr_template": "- #{{TITLE}}" + } + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt-get install -y raptor2-utils + + # don't validate here because there is a separate SHACL action and there are unvalidated parts of SNIK that would fail the release + - name: Build + run: ./scripts/combine + + - name: Create Release + id: create-release + uses: softprops/action-gh-release@v2 + with: + body: ${{steps.build-changelog.outputs.changelog}} + files: | + dist/snik.nt + dist/snik.ttl diff --git a/.github/workflows/shacl.yml b/.github/workflows/shacl.yml index 3b67f85..7b48788 100644 --- a/.github/workflows/shacl.yml +++ b/.github/workflows/shacl.yml @@ -1,11 +1,11 @@ name: SHACL - + on: workflow_dispatch: push: branches: - master - + jobs: shacl: runs-on: ubuntu-latest @@ -13,7 +13,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Build and Validate + - name: Validate uses: konradhoeffner/shacl@v1 with: data: | diff --git a/.gitignore b/.gitignore index ffd1cd1..6976b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ .* dist +!.github diff --git a/scripts/combine b/scripts/combine index c2f5f91..b4f50da 100755 --- a/scripts/combine +++ b/scripts/combine @@ -8,6 +8,7 @@ DISTPATH=$MYPATH/../dist mkdir -p $DISTPATH cat $MYPATH/../*.ttl $MYPATH/../*.nt | rapper -i turtle -o turtle - http://www.snik.eu/ontology/ > $DISTPATH/snik.ttl cd $DISTPATH +rapper -i turtle -o ntriples snik.ttl > snik.nt GITHUB_STEP_SUMMARY="`wc -l snik.nt | cut -f1 -d ' '` triples \n\n" if type awk > /dev/null 2>&1; then GITHUB_STEP_SUMMARY+="| Filename | bytes | KiB | MiB | KB | MB |\n"