From 379ae604bf24b66e17e9eaf67c854a7729b759a1 Mon Sep 17 00:00:00 2001 From: Ionite Date: Wed, 21 Jun 2023 15:56:35 -0400 Subject: [PATCH 1/2] Fix version bump ci --- .github/workflows/version-bump-pr.yml | 60 +++++++++++++++++++++++ .github/workflows/version-bump.yml | 36 ++++++++++++++ .github/workflows/versioning.yml | 68 --------------------------- 3 files changed, 96 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/version-bump-pr.yml create mode 100644 .github/workflows/version-bump.yml delete mode 100644 .github/workflows/versioning.yml diff --git a/.github/workflows/version-bump-pr.yml b/.github/workflows/version-bump-pr.yml new file mode 100644 index 00000000..f67152e2 --- /dev/null +++ b/.github/workflows/version-bump-pr.yml @@ -0,0 +1,60 @@ +name: Version Bump + +on: + push: + branches: [main] + +jobs: + get-pr-labels: + runs-on: ubuntu-latest + outputs: + pr_number: ${{ steps.get_merged_pull_request.outputs.number }} + pr_labels: ${{ steps.get_merged_pull_request.outputs.labels }} + version_mask: ${{ steps.get_merged_pull_request.outputs.version_mask }} + steps: + - name: Get Merged PR Labels + id: get_merged_pull_request + uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "pr_number=${{ steps.get_merged_pull_request.outputs.number }}" >> "$GITHUB_OUTPUT" + echo "pr_labels=${{ steps.get_merged_pull_request.outputs.labels }}" >> "$GITHUB_OUTPUT" + echo PR Number: ${{ steps.get_merged_pull_request.outputs.number }} + echo PR Labels: ${{ steps.get_merged_pull_request.outputs.labels }} + + if [[ "${{ steps.get_merged_pull_request.outputs.labels }}" == *"Bump Major"* ]]; then + echo "Bump Major" + echo "version_mask=1.0.0.0" >> "$GITHUB_ENV" + elif [[ "${{ steps.get_merged_pull_request.outputs.labels }}" == *"Bump Minor"* ]]; then + echo "Bump Minor" + echo "version_mask=0.1.0.0" >> "$GITHUB_ENV" + elif [[ "${{ steps.get_merged_pull_request.outputs.labels }}" == *"Bump Patch"* ]]; then + echo "Bump Patch" + echo "version_mask=0.0.1.0" >> "$GITHUB_ENV" + else + echo "No Bump Label" + fi + + version-bump-pr: + name: Version Bump PR + needs: get-pr-labels + runs-on: windows-latest + env: + version_mask: ${{ needs.get-pr-labels.outputs.version_mask }} + version_overwrite: "*.*.*.*" + steps: + - uses: actions/checkout@v3 + - name: Setup .NET Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Bump versions + uses: SiqiLu/dotnet-bump-version@2.0.0 + with: + version_files: "**/*.csproj" + version_mask: ${{ env.version_mask }} + version_overwrite: ${{ env.version_overwrite }} + github_token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml new file mode 100644 index 00000000..68103040 --- /dev/null +++ b/.github/workflows/version-bump.yml @@ -0,0 +1,36 @@ +name: Version Bump + +on: + workflow_dispatch: + inputs: + version_mask: + type: string + description: Version Bump Mask + default: "0.0.1.0" + required: false + + version_overwrite: + type: string + description: Version Overwrite Mask + default: "*.*.*.*" + required: false + +jobs: + version-bump: + name: Version Bump + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Bump versions + uses: SiqiLu/dotnet-bump-version@2.0.0 + with: + version_files: "**/*.csproj" + version_mask: ${{ github.event.inputs.version_mask }} + version_overwrite: ${{ github.event.inputs.version_overwrite }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml deleted file mode 100644 index 2becb31b..00000000 --- a/.github/workflows/versioning.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Version Bump - -on: - pull_request: - types: [closed] - branches: ["main"] - - workflow_dispatch: - inputs: - version_mask: - type: string - description: Version Bump Mask - default: "0.0.1.0" - required: false - - version_overwrite: - type: string - description: Version Overwrite Mask - default: "*.*.*.*" - required: false - -jobs: - version-bump: - # Run on PR merge or manual trigger - if: | - github.event_name == 'workflow_dispatch' || ( - github.event_name == 'pull_request' && github.event.pull_request.merged == true - ) - runs-on: windows-latest - steps: - # Manual Mode - - name: Manual Version Mask - if: github.event_name == 'workflow_dispatch' - run: | - echo "version_mask=${{ github.event.inputs.version_mask }}" >> "$GITHUB_ENV" - echo "version_overwrite=${{ github.event.inputs.version_overwrite }}" >> "$GITHUB_ENV" - - # On PR Labels - - name: Set Overwrite Mask - if: github.event_name == 'pull_request' - run: | - echo "version_overwrite=*.*.*.*" >> "$GITHUB_ENV" - - - name: Label Major Version Mask - if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Bump Major') - run: echo "version_mask=1.0.0.0" >> "$GITHUB_ENV" - - - name: Label Minor Version Mask - if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Bump Minor') - run: echo "version_mask=0.1.0.0" >> "$GITHUB_ENV" - - - name: Label Patch Version Mask - if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Bump Patch') - run: echo "version_mask=0.0.1.0" >> "$GITHUB_ENV" - - - uses: actions/checkout@v3 - - name: Setup .NET Core - uses: actions/setup-dotnet@v2 - with: - dotnet-version: 6.0.x - - - name: Bump versions - uses: SiqiLu/dotnet-bump-version@2.0.0 - with: - version_files: "**/*.csproj" - version_mask: ${{ env.version_mask }} - version_overwrite: ${{ env.version_overwrite }} - github_token: ${{ secrets.GITHUB_TOKEN }} From 9734e84670548144c3820ec38e516af23a3dba42 Mon Sep 17 00:00:00 2001 From: Ionite Date: Wed, 21 Jun 2023 16:10:28 -0400 Subject: [PATCH 2/2] Fix build ci publishreadytorun --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8417a5fe..16d7a2f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,10 +24,10 @@ jobs: dotnet-version: '6.0.x' - name: Install dependencies - run: dotnet restore + run: dotnet restore -p:PublishReadyToRun=true - name: Build - run: dotnet publish .\\StabilityMatrix\\StabilityMatrix.csproj -o out -c Release -r win-x64 -p:PublishReadyToRun=true --self-contained true --no-restore + run: dotnet publish .\\StabilityMatrix\\StabilityMatrix.csproj -o out -c Release -r win-x64 -p:PublishReadyToRun=true --self-contained true # Make a zip file of the build (only StabilityMatrix.exe) - name: Zip Artifact