diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65bca9a..226c291 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,17 +14,12 @@ jobs: runs-on: ubuntu-latest steps: + - name: repo_basename + run: echo "REPOSITORY_NAME=`basename ${{ github.repository }}`" >> $GITHUB_ENV + - name: Checkout repository uses: actions/checkout@v2 - - name: Set up .NET - uses: actions/setup-dotnet@v2 - with: - dotnet-version: '8.0.x' - - - name: Install dependencies - run: dotnet restore - - name: Get current version from ${{ env.REPOSITORY_FOLDER }}.cs id: get_version run: | @@ -46,6 +41,16 @@ jobs: echo "new_version=false" >> $GITHUB_ENV fi + - name: Set up .NET + uses: actions/setup-dotnet@v2 + if: env.new_version == 'true' + with: + dotnet-version: '8.0.x' + + - name: Install dependencies + if: env.new_version == 'true' + run: dotnet restore + - name: Build project if: env.new_version == 'true' run: dotnet publish -c Release @@ -53,11 +58,11 @@ jobs: - name: Rename release directory if: env.new_version == 'true' run: | - mv /home/runner/work/${{ github.repository }}/${{ github.repository }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/publish/ /home/runner/work/${{ github.repository }}/${{ github.repository }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/${{ env.REPOSITORY_FOLDER }}/ + mv /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/publish/ /home/runner/work/${{ github.repository }}/${{ github.repository }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/${{ env.REPOSITORY_FOLDER }}/ - name: Zip release if: env.new_version == 'true' - run: cd /home/runner/work/${{ github.repository }}/${{ github.repository }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0 && zip -r /home/runner/work/${{ github.repository }}-${{ env.version }}.zip ${{ env.REPOSITORY_FOLDER }} + run: cd /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0 && zip -r /home/runner/work/${{ github.repository }}-${{ env.version }}.zip ${{ env.REPOSITORY_FOLDER }} - name: Get release notes if: env.new_version == 'true' @@ -88,4 +93,4 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: /home/runner/work/{{ env.REPOSITORY_NAME }}-${{ env.version }}.zip asset_name: ${{ github.repository }}-${{ env.version }}.zip - asset_content_type: application/zip \ No newline at end of file + asset_content_type: application/zip