From d61ceed410325b4592fea6265fd5231cddb87ac7 Mon Sep 17 00:00:00 2001 From: Stefan Frehse Date: Tue, 12 Nov 2024 12:21:11 +0100 Subject: [PATCH] fix(): Adds a release job --- .github/workflows/release.yaml | 49 +++++++++++++++++++ .gitignore | 1 + .../hello-world}/data-policy.json.vm | 0 modules/hello-world/index.json | 27 ++++++++++ .../hello-world}/schema.json | 0 .../hello-world}/variables.json | 0 my-custom-module/index.json | 29 ----------- 7 files changed, 77 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .gitignore rename {my-custom-module => modules/hello-world}/data-policy.json.vm (100%) create mode 100644 modules/hello-world/index.json rename {my-custom-module => modules/hello-world}/schema.json (100%) rename {my-custom-module => modules/hello-world}/variables.json (100%) delete mode 100644 my-custom-module/index.json diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..22cc28e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,49 @@ +name: Release a Module Version + +on: + push: + tags: + - "v*" + +jobs: + create-a-new-release: + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_name: hello-world + runs-on: ubuntu-latest + steps: + - name: Checkout project sources + uses: actions/checkout@v4 + + - name: Compile the modules + id: compile_the_modules + run: | + cd modules + for d in */ ; do + version=$(jq -r '.version' $d/index.json) + filename= ${d}-${version}.module + zip -z $filename + echo $filename >> release_notes.txt + done + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body_path: modules/release_notes.txt + draft: false + prerelease: false + - name: upload artifacts + id: upload_artifacts + env: + GITHUB_TOKEN: ${{ secerts.GITHUB_TOKEN }} + run: | + for module in modules/*.module; do + gh release upload ${{ github.ref }} + done + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6309cc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/*.module \ No newline at end of file diff --git a/my-custom-module/data-policy.json.vm b/modules/hello-world/data-policy.json.vm similarity index 100% rename from my-custom-module/data-policy.json.vm rename to modules/hello-world/data-policy.json.vm diff --git a/modules/hello-world/index.json b/modules/hello-world/index.json new file mode 100644 index 0000000..033553d --- /dev/null +++ b/modules/hello-world/index.json @@ -0,0 +1,27 @@ +{ + "name": "hello-world-module", + "description": "This is a hello world module to demonstrate", + "maintainers": [ + { + "name": "hello-world-maintainer" + } + ], + "version": "1.0.0", + "requiredSystemVersions": [ + "hivemq-enterprise/4.34.0" + ], + "resources": { + "files": [ + { + "type": "application/vnd+hivemq.data-policy+json", + "path": "data-policy.json.vm", + "name": "Data Policy to handle non-JSON messages" + }, + { + "type": "application/vnd+hivemq.schema+json", + "path": "schema.json", + "name": "Simple JSON schema" + } + ] + } +} diff --git a/my-custom-module/schema.json b/modules/hello-world/schema.json similarity index 100% rename from my-custom-module/schema.json rename to modules/hello-world/schema.json diff --git a/my-custom-module/variables.json b/modules/hello-world/variables.json similarity index 100% rename from my-custom-module/variables.json rename to modules/hello-world/variables.json diff --git a/my-custom-module/index.json b/my-custom-module/index.json deleted file mode 100644 index 32b2cdf..0000000 --- a/my-custom-module/index.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "My first custom module", - "description": "My first custom module description", - "maintainers": [ - { - "name": "my required name", - "email": "my-optional-email-address@provider.com", - "url": "https://my-optional.website.com" - } - ], - "version": "1.0.0", - "requiredSystemVersions": [ - "hivemq-enterprise/4.34.0" - ], - "resources": { - "files": [ - { - "type": "application/vnd+hivemq.data-policy+json", - "path": "data-policy.json.vm", - "name": "Data Policy to handle non-JSON messages" - }, - { - "type": "application/vnd+hivemq.schema+json", - "path": "schema.json", - "name": "Simple JSON schema" - } - ] - } -}