From f1211f9aa71e7508764d22528e6ac65508579262 Mon Sep 17 00:00:00 2001 From: Andrey Onishchenko Date: Fri, 2 Feb 2024 19:19:20 +0300 Subject: [PATCH] create release if needed in CI --- .github/workflows/build.yml | 21 ++++++++++++--------- .github/workflows/retrieve_version.sh | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/retrieve_version.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62346d6..543bf51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,22 +68,25 @@ jobs: runs-on: ubuntu-latest needs: [build, nix-build] steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifact uses: actions/download-artifact@v4 with: merge-multiple: true path: dist - - id: data - uses: pozetroninc/github-action-get-latest-release@v0.7.0 - with: - repository: ${{ github.repository }} + - name: Retrieve version + run: sh ./.github/workflows/retrieve_version.sh - name: Upload files to a GitHub release - uses: svenstaro/upload-release-action@v2 + uses: ncipollo/release-action@v1.13.0 with: - file: dist/* - tag: ${{ steps.data.outputs.release }} - overwrite: true - file_glob: true + allowUpdates: true + artifacts: dist/* + makeLatest: true + name: ${{ env.release_name }} + replacesArtifacts: true + tag: ${{ env.tag_name }} \ No newline at end of file diff --git a/.github/workflows/retrieve_version.sh b/.github/workflows/retrieve_version.sh new file mode 100644 index 0000000..f0fa950 --- /dev/null +++ b/.github/workflows/retrieve_version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# install jq +sudo apt-get update +sudo apt-get install jq + +# get version +VERSION=$(jq -r '.version' version_info.json) +release_name="Beta $VERSION" +tag_name="v$VERSION" + +#write variables to github env +echo "VERSION=$VERSION" >> $GITHUB_ENV +echo "release_name=$release_name" >> $GITHUB_ENV +echo "tag_name=$tag_name" >> $GITHUB_ENV \ No newline at end of file