diff --git a/.github/workflows/build-tool.yml b/.github/workflows/build-tool.yml index 77d19cb..0d9d974 100644 --- a/.github/workflows/build-tool.yml +++ b/.github/workflows/build-tool.yml @@ -69,11 +69,18 @@ jobs: - name: Execute dotnet pack with production version (dev or future) - if: ${{ github.ref_name == 'dev' || github.ref_name == 'future'}} + if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' }} run: | PRODUCTION_VERSION="$(cat VERSION)"-"${{github.ref_name}}"."${{github.run_number}}" echo "PRODUCTION_VERSION = ${PRODUCTION_VERSION}" dotnet pack --configuration Release --no-build --no-restore --output artifacts/packages -p:PackageVersion=$PRODUCTION_VERSION + + - name: Execute dotnet pack with release candidate from pull request + if: ${{ startsWith(github.head_ref, 'rc-')}} + run: | + PRODUCTION_VERSION="$(cat VERSION)"-"${{github.head_ref}}"."${{github.run_number}}" + echo "PRODUCTION_VERSION = ${PRODUCTION_VERSION}" + dotnet pack --configuration Release --no-build --no-restore --output artifacts/packages -p:PackageVersion=$PRODUCTION_VERSION - name: Upload package artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/publish-tool.yml b/.github/workflows/publish-tool.yml index e57a31c..e6c99d9 100644 --- a/.github/workflows/publish-tool.yml +++ b/.github/workflows/publish-tool.yml @@ -35,7 +35,6 @@ on: jobs: Publish: - if: ${{ github.event_name == 'push' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -56,7 +55,7 @@ jobs: # Use if dev branch - name: Publish on MyGet-CI - if: ${{ github.ref == 'refs/heads/dev' }} # dev branche is published to myget moryx + if: ${{ github.ref == 'refs/heads/dev' || (github.base_ref == 'dev' && startsWith(github.head_ref, 'rc-')) }} # dev branche is published to myget moryx env: MORYX_NUGET_APIKEY: ${{secrets.MYGET_TOKEN}} MORYX_PACKAGE_TARGET: ${{ inputs.MORYX_PACKAGE_TARGET_DEV }} diff --git a/README.md b/README.md index 7177c02..1c06e64 100644 --- a/README.md +++ b/README.md @@ -45,4 +45,10 @@ To add the information gathered in the workflow to be shown on the MORYX-CodeCov ## Contribute -If you have an idea to improve a template or can think of a new useful template, please make your changes based on one of the template branches and open a pull request. If you want to add a template, extend the branch list in one commit and the template definition in another. This way we can easily put your template into a separate branch. **Note:** All branches except *master* will be rebased regularly, to keep grafting them easy. To avoid losing previous merge request information, all branch merge requests are merged by rebase squashing. \ No newline at end of file +If you have an idea to improve a template or can think of a new useful template, please make your changes based on one of the template branches and open a pull request. If you want to add a template, extend the branch list in one commit and the template definition in another. This way we can easily put your template into a separate branch. **Note:** All branches except *master* will be rebased regularly, to keep grafting them easy. To avoid losing previous merge request information, all branch merge requests are merged by rebase squashing. + +### Github ref variables + +The detailted documentation is [here](https://docs.github.com/de/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context). However it was not always obvious what value was where. + +- current branch: When building on a push to e.g. dev, the current branch is in `ref_name`. However in pull requests this refers to the pull-request id and you need `head_ref` instead \ No newline at end of file