Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #51 from kurmann/50-neuer-ansatz-um-gh-cli-zu-benu…
Browse files Browse the repository at this point in the history
…tzen-für-releases-und-pre-releases

Pre-Releases werden mit berücksichtigt bei den zuletzt veröffentlichten Releases Closes #49 Closes #50
  • Loading branch information
kurmann authored Apr 25, 2024
2 parents f184506 + 2f33def commit 8684aa1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,40 @@ env:
DOTNET_VERSION: '8.0.x'

jobs:
get_release:
get_release_or_prerelease:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get latest release including prereleases
id: get_release
- name: Get latest release or prerelease
id: get_release_or_prerelease
run: |
RELEASE_JSON=$(gh release list --limit 1 --json tagName,name,url,prerelease --jq '.[0]')
echo "RELEASE_JSON=${RELEASE_JSON}"
RELEASE_TAG_NAME=$(echo "$RELEASE_JSON" | jq -r '.tagName')
RELEASE_NAME=$(echo "$RELEASE_JSON" | jq -r '.name')
RELEASE_URL=$(echo "$RELEASE_JSON" | jq -r '.url')
RELEASES_JSON=$(gh release list --json tagName,name,isPrerelease)
LATEST_RELEASE_OR_PRERELEASE_JSON=$(echo "$RELEASES_JSON" | jq -r '.[0]')
RELEASE_TAG_NAME=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.tagName')
RELEASE_NAME=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.name')
RELEASE_IS_PRERELEASE=$(echo "$LATEST_RELEASE_OR_PRERELEASE_JSON" | jq -r '.isPrerelease')
RELEASE_VERSION="${RELEASE_TAG_NAME#"v"}"
IS_PRERELEASE=$(echo "$RELEASE_JSON" | jq -r '.prerelease')
REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
RELEASE_URL="${REPO_URL}/releases/tag/${RELEASE_TAG_NAME}"
echo "release_version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
echo "release_tag_name=$RELEASE_TAG_NAME" >> "$GITHUB_OUTPUT"
echo "release_url=$RELEASE_URL" >> "$GITHUB_OUTPUT"
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
echo "release_is_prerelease=$RELEASE_IS_PRERELEASE" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release_version: ${{ steps.get_release.outputs.release_version }}
release_tag_name: ${{ steps.get_release.outputs.release_tag_name }}
release_url: ${{ steps.get_release.outputs.release_url }}
is_prerelease: ${{ steps.get_release.outputs.is_prerelease }}
release_version: ${{ steps.get_release_or_prerelease.outputs.release_version }}
release_tag_name: ${{ steps.get_release_or_prerelease.outputs.release_tag_name }}
release_url: ${{ steps.get_release_or_prerelease.outputs.release_url }}
release_is_prerelease: ${{ steps.get_release_or_prerelease.outputs.release_is_prerelease }}

build_and_publish:
needs: get_release
needs: get_release_or_prerelease
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -63,10 +67,10 @@ jobs:
# Hinweis: Kein Symbolpaket da es sich um ein Template-Projekt handelt.
- name: Pack
run: |
echo "Using version ${{ needs.get_release.outputs.release_version }} from setup job."
echo "Using version ${{ needs.get_release_or_prerelease.outputs.release_version }} from setup job."
dotnet pack ${{ env.CSPROJ_FILE }} --no-build --configuration Release \
-p:PackageVersion=${{ needs.get_release.outputs.release_version }} \
-p:PackageReleaseNotes=${{ needs.get_release.outputs.release_url }} \
-p:PackageVersion=${{ needs.get_release_or_prerelease.outputs.release_version }} \
-p:PackageReleaseNotes=${{ needs.get_release_or_prerelease.outputs.release_url }} \
-p:PackageProjectUrl="https://github.com/${{ github.repository }}" \
-p:RepositoryUrl="https://github.com/${{ github.repository }}.git" \
-p:RepositoryType="git" \
Expand Down

0 comments on commit 8684aa1

Please sign in to comment.