diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 970e5a8..a02adb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,25 +14,25 @@ jobs: runs-on: ubuntu-latest steps: - - name: repo_basename + - name: Get Repository Name run: echo "REPOSITORY_NAME=`basename ${{ github.repository }}`" >> $GITHUB_ENV - - name: Checkout repository + - name: Checkout Repository uses: actions/checkout@v2 - - name: Get current version from ${{ env.REPOSITORY_FOLDER }}.cs + - name: Get Current Project Version Number From ${{ env.REPOSITORY_FOLDER }}.cs id: get_version run: | version=$(grep -oP '(?<=ModuleVersion => ")[^"]*' ${{ env.REPOSITORY_FOLDER }}/${{ env.REPOSITORY_FOLDER }}.cs) echo "version=$version" >> $GITHUB_ENV - - name: Get latest release version + - name: Get Current Release Version Number id: get_latest_release run: | latest_release=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) echo "latest_release=$latest_release" >> $GITHUB_ENV - - name: Compare versions + - name: Compare Versions id: compare_versions run: | if [ "${{ env.version }}" != "${{ env.latest_release }}" ]; then @@ -41,37 +41,37 @@ jobs: echo "new_version=false" >> $GITHUB_ENV fi - - name: Set up .NET + - name: Install .NET uses: actions/setup-dotnet@v2 if: env.new_version == 'true' with: dotnet-version: '8.0.x' - - name: Install dependencies + - name: Install Dependencies if: env.new_version == 'true' run: dotnet restore - - name: Build project + - name: Build ${{ env.REPOSITORY_NAME }} if: env.new_version == 'true' run: dotnet publish -c Release - - name: Rename release directory + - name: Prepare Release if: env.new_version == 'true' run: | mv /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/publish/ /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0/${{ env.REPOSITORY_FOLDER }}/ - - name: Zip release + - name: Compress Release if: env.new_version == 'true' run: cd /home/runner/work/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_NAME }}/${{ env.REPOSITORY_FOLDER }}/bin/Release/net8.0 && zip -r /home/runner/work/${{ env.REPOSITORY_NAME }}-${{ env.version }}.zip ${{ env.REPOSITORY_FOLDER }} - - name: Get release notes + - name: Build Release Notes if: env.new_version == 'true' id: get_release_notes run: | release_notes=$(git log --pretty=format:"[%h](https://github.com/${{ github.repository }}/commit/%H) - %s (%an)" $(git describe --tags --abbrev=0)..HEAD) echo "release_notes=$release_notes" >> $GITHUB_ENV - - name: Create GitHub release + - name: Add Release on Github id: create_release if: env.new_version == 'true' uses: actions/create-release@v1 @@ -84,7 +84,7 @@ jobs: draft: false prerelease: false - - name: Upload release asset + - name: Upload ${{ env.REPOSITORY_NAME }}-${{ env.version }}.zip if: env.new_version == 'true' uses: actions/upload-release-asset@v1 env: