From abf247d37e04f53c1e327fcd90a1461d6513d13c Mon Sep 17 00:00:00 2001 From: Aaron T Date: Mon, 23 Oct 2023 16:03:35 +0100 Subject: [PATCH] Feat: auto release (#29) * release-artifacts.yml * fix: permission denied error * retry * remove install gh cli * fix: typo * retry * retry * retry * better way of releasing the artifact * correctly get the tag * combined workflow * added github token * check release exists * skip publishing * fix: if check for tagname * fix: if check for tagname * sleep until release is made * retry * fix: get latest tag properly and use as an env variable * another attempt * fix: proper upload --- .github/workflows/release-creation.yml | 33 +++++++------------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release-creation.yml b/.github/workflows/release-creation.yml index 6488a23..fbbe274 100644 --- a/.github/workflows/release-creation.yml +++ b/.github/workflows/release-creation.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v2 - name: Release Please - id: release-please + id: release uses: google-github-actions/release-please-action@v3 with: release-type: simple @@ -33,22 +33,7 @@ jobs: sleep 120 # Sleep for 2 minutes (2 minutes * 60 seconds/minute) shell: bash - - name: Check Release Creation - run: | - if ${{ steps.release-please.outputs.release_created }} == true; then - exit 1 - fi - latest_tag=$(gh release list --limit 1 --repo ${{ env.Repo }} | awk '{print $1}') - echo "latest_tag=$latest_tag" >> $GITHUB_ENV - release_please_tag= ${{ steps.release-please.outputs.tag_name }} - echo "release_please_tag=$release_please_tag" >> $GITHUB_ENV - if gh release view " $latest_tag " > /dev/null; then - echo "Release was created." - else - echo "Release not created. Exiting." - exit 1 - fi - shell: bash + if: ${{ steps.release.outputs.release_created }} - name: Publish Windows Build run: dotnet publish ${{github.workspace}}/RTWLib_CLI/RTWLib_CLI.csproj -c Release -r win-x64 --self-contained true -o ./publish/win-x64 @@ -77,12 +62,12 @@ jobs: name: RTWRand-linux path: ${{github.workspace}}/publish/linux-x64 - - - name: Upload Release Artifacts + - name: Upload Release Artifact + if: ${{ steps.release.outputs.release_created }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - release_tag="${{ env.latest_tag }}" - gh release upload "$release_tag" ${{github.workspace}}/publish/win-x64/* --clobber - gh release upload "$release_tag" ${{github.workspace}}/publish/osx-x64/* --clobber - gh release upload "$release_tag" ${{github.workspace}}/publish/linux-x64/* --clobber - shell: bash + gh release upload ${{ steps.release.outputs.tag_name }} ${{github.workspace}}/publish/win-x64/* --clobber + gh release upload ${{ steps.release.outputs.tag_name }} ${{github.workspace}}/publish/osx-x64/* --clobber + gh release upload ${{ steps.release.outputs.tag_name }} ${{github.workspace}}/publish/linux-x64/* --clobber