|
5 | 5 | types: [published] |
6 | 6 |
|
7 | 7 | workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version_type: |
| 10 | + type: choice |
| 11 | + description: 'Version Type' |
| 12 | + required: true |
| 13 | + default: rebuild |
| 14 | + options: |
| 15 | + - rebuild |
| 16 | + - patch |
| 17 | + - minor |
| 18 | + - major |
| 19 | + publish_release: |
| 20 | + description: "Publish Release" |
| 21 | + type: boolean |
| 22 | + required: true |
| 23 | + default: true |
8 | 24 |
|
9 | 25 | jobs: |
10 | | - build: |
11 | | - name: Build |
12 | | - permissions: write-all |
| 26 | + bump_version: |
| 27 | + name: Bump Version |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: write-all |
| 30 | + outputs: |
| 31 | + current_version: ${{ steps.get_version.outputs.current_version }} |
| 32 | + new_version: ${{ steps.bump.outputs.current-version || steps.bump_manual.outputs.current-version }} |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: fregante/setup-git-user@v2 |
| 36 | + |
| 37 | + - name: Install bump-my-version |
| 38 | + run: pip install bump-my-version |
13 | 39 |
|
14 | | - runs-on: windows-latest |
| 40 | + - name: Get current version |
| 41 | + id: get_version |
| 42 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type == 'rebuild' }} |
| 43 | + run: echo "current_version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT |
15 | 44 |
|
16 | | - steps: |
17 | | - - uses: actions/checkout@v4 |
| 45 | + - name: Bump version |
| 46 | + id: bump |
| 47 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }} |
| 48 | + run: | |
| 49 | + echo "previous-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT |
| 50 | + bump-my-version bump ${{ inputs.version_type }} |
| 51 | + ([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") >> $GITHUB_OUTPUT |
| 52 | + echo "current-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT |
18 | 53 |
|
19 | | - - name: Add msbuild to PATH |
20 | | - uses: microsoft/setup-msbuild@v2 |
| 54 | + - name: Bump version (Manual) |
| 55 | + id: bump_manual |
| 56 | + if: ${{ github.event_name == 'release' }} |
| 57 | + run: | |
| 58 | + echo "previous-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT |
| 59 | + bump-my-version bump --new-version ${{ github.ref_name }} |
| 60 | + ([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") >> $GITHUB_OUTPUT |
| 61 | + echo "current-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT |
21 | 62 |
|
22 | | - - name: Integrate vcpkg |
23 | | - run: vcpkg integrate install |
| 63 | + - name: Push changes to GitHub |
| 64 | + uses: ad-m/github-push-action@master |
| 65 | + with: |
| 66 | + force: true |
24 | 67 |
|
25 | | - - name: Build |
26 | | - run: msbuild QuantumStreamer.sln -property:Configuration=Release |
| 68 | + build: |
| 69 | + name: Build |
| 70 | + permissions: write-all |
| 71 | + needs: bump_version |
| 72 | + runs-on: windows-latest |
27 | 73 |
|
28 | | - - name: Upload release artifact |
29 | | - uses: actions/upload-artifact@v4 |
30 | | - with: |
31 | | - name: ReleaseBuild |
32 | | - path: x64\Release |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + if: ${{ github.event_name == 'release' || github.event.inputs.version_type == 'rebuild' }} |
33 | 77 |
|
34 | | - - name: Upload Release |
35 | | - uses: softprops/action-gh-release@v2 |
36 | | - with: |
37 | | - files: ./x64/Release/loc_x64_f.dll |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }} |
| 80 | + with: |
| 81 | + ref: v${{ needs.bump_version.outputs.new_version }} |
| 82 | + |
| 83 | + - name: Add msbuild to PATH |
| 84 | + uses: microsoft/setup-msbuild@v2 |
| 85 | + |
| 86 | + - name: Integrate vcpkg |
| 87 | + run: vcpkg integrate install |
| 88 | + |
| 89 | + - name: Build |
| 90 | + run: msbuild QuantumStreamer.sln -property:Configuration=Release |
| 91 | + |
| 92 | + - name: Upload release artifact |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: ReleaseBuild |
| 96 | + path: x64\Release |
| 97 | + |
| 98 | + - name: Upload Release |
| 99 | + uses: softprops/action-gh-release@v2 |
| 100 | + with: |
| 101 | + files: ./x64/Release/loc_x64_f.dll |
| 102 | + |
| 103 | + - name: Upload Release (manual) |
| 104 | + if: ${{ github.event_name == 'release' }} |
| 105 | + uses: softprops/action-gh-release@v2 |
| 106 | + with: |
| 107 | + files: ./x64/Release/loc_x64_f.dll |
| 108 | + |
| 109 | + - name: Upload Release |
| 110 | + if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true' && github.event.inputs.version_type != 'rebuild') || github.event_name == 'release' }} |
| 111 | + uses: softprops/action-gh-release@v2 |
| 112 | + with: |
| 113 | + files: ./x64/Release/loc_x64_f.dll |
| 114 | + tag_name: v${{ needs.bump_version.outputs.new_version }} |
| 115 | + |
| 116 | + - name: Upload Re-Release |
| 117 | + if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true' && github.event.inputs.version_type == 'rebuild') && github.event_name != 'release' }} |
| 118 | + uses: softprops/action-gh-release@v2 |
| 119 | + with: |
| 120 | + files: ./x64/Release/loc_x64_f.dll |
| 121 | + tag_name: v${{ needs.bump_version.outputs.current_version }} |
0 commit comments