From 32f98117eff6fea508fd6886d680a13b801ad918 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Fri, 23 Jun 2023 20:48:38 +0200 Subject: [PATCH] Added make-release.yml workflow. --- .github/workflows/make-release.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/make-release.yml diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml new file mode 100644 index 0000000..6f45c11 --- /dev/null +++ b/.github/workflows/make-release.yml @@ -0,0 +1,49 @@ +name: Make Release + +on: + push: + branches: ["main"] + tags: ["v*"] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: "17" + distribution: "temurin" + + - name: Build with Maven + id: build + run: | + mvn -B package --file pom.xml + asset=$(find target/ -type f -name "*jar-with-dependencies.jar") + echo "::set-output name=asset_path::$asset" + + - name: Extract Tag Version + id: get_version + run: echo "::set-output name=tag_version::${GITHUB_REF/refs\/tags\//}" + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + name: MaterialsExtractor ${{steps.get_version.outputs.tag_version}} + + - name: Upload Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_name: materials-extractor-${{steps.get_version.outputs.tag_version}}.jar + asset_path: ${{steps.build.outputs.asset_path}} + asset_content_type: application/java-archive