Skip to content

Commit

Permalink
Feat: auto release (#29)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sargeantPig authored Oct 23, 2023
1 parent cd02b0c commit abf247d
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/release-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit abf247d

Please sign in to comment.