From 87ccb913a9266d63d12a85b6a44756dbf005f53f Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Wed, 30 Apr 2025 15:21:17 +0200 Subject: [PATCH 1/5] Publish branches with rc/* pattern as CI --- .github/workflows/build-tool.yml | 2 +- .github/workflows/publish-tool.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-tool.yml b/.github/workflows/build-tool.yml index 77d19cb..00f5908 100644 --- a/.github/workflows/build-tool.yml +++ b/.github/workflows/build-tool.yml @@ -69,7 +69,7 @@ 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' || startsWith(github.ref, '/refs/heads/rc/')}} run: | PRODUCTION_VERSION="$(cat VERSION)"-"${{github.ref_name}}"."${{github.run_number}}" echo "PRODUCTION_VERSION = ${PRODUCTION_VERSION}" diff --git a/.github/workflows/publish-tool.yml b/.github/workflows/publish-tool.yml index e57a31c..6f59ef5 100644 --- a/.github/workflows/publish-tool.yml +++ b/.github/workflows/publish-tool.yml @@ -56,7 +56,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' }} # dev branche is published to myget moryx env: MORYX_NUGET_APIKEY: ${{secrets.MYGET_TOKEN}} MORYX_PACKAGE_TARGET: ${{ inputs.MORYX_PACKAGE_TARGET_DEV }} From 1f08472676cb03cac7ac74b4423a195255ffcf4e Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Tue, 20 May 2025 13:17:04 +0200 Subject: [PATCH 2/5] Naming pattern with hyphen --- .github/workflows/build-tool.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-tool.yml b/.github/workflows/build-tool.yml index 00f5908..45f2e7a 100644 --- a/.github/workflows/build-tool.yml +++ b/.github/workflows/build-tool.yml @@ -69,7 +69,7 @@ jobs: - name: Execute dotnet pack with production version (dev or future) - if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || startsWith(github.ref, '/refs/heads/rc/')}} + if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || startsWith(github.ref_name, 'rc-')}} run: | PRODUCTION_VERSION="$(cat VERSION)"-"${{github.ref_name}}"."${{github.run_number}}" echo "PRODUCTION_VERSION = ${PRODUCTION_VERSION}" From 5e25cc5c2d118468ef7485ad60338b0d4aca668b Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Wed, 21 May 2025 21:15:45 +0200 Subject: [PATCH 3/5] Use head-ref to determine branch name in pipeline --- .github/workflows/build-tool.yml | 2 +- .github/workflows/publish-tool.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-tool.yml b/.github/workflows/build-tool.yml index 45f2e7a..b64202d 100644 --- a/.github/workflows/build-tool.yml +++ b/.github/workflows/build-tool.yml @@ -69,7 +69,7 @@ jobs: - name: Execute dotnet pack with production version (dev or future) - if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || startsWith(github.ref_name, 'rc-')}} + if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || startsWith(github.head_ref, 'rc-')}} run: | PRODUCTION_VERSION="$(cat VERSION)"-"${{github.ref_name}}"."${{github.run_number}}" echo "PRODUCTION_VERSION = ${PRODUCTION_VERSION}" diff --git a/.github/workflows/publish-tool.yml b/.github/workflows/publish-tool.yml index 6f59ef5..9bb9467 100644 --- a/.github/workflows/publish-tool.yml +++ b/.github/workflows/publish-tool.yml @@ -56,7 +56,7 @@ jobs: # Use if dev branch - name: Publish on MyGet-CI - if: ${{ github.ref == 'refs/heads/dev' || github.base_ref == '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 }} From 444bad4ee7ca0745cb0304ca5a1f5e6edf6cf98b Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Thu, 22 May 2025 12:35:45 +0200 Subject: [PATCH 4/5] Fix and document rc version --- .github/workflows/build-tool.yml | 9 ++++++++- README.md | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-tool.yml b/.github/workflows/build-tool.yml index b64202d..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' || startsWith(github.head_ref, 'rc-')}} + 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/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 From 50b0f7334f814e329ba6e76db1867b0978e9639e Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Sun, 25 May 2025 20:57:14 +0200 Subject: [PATCH 5/5] Remove push constraint --- .github/workflows/publish-tool.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-tool.yml b/.github/workflows/publish-tool.yml index 9bb9467..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