Ionite
1 year ago
committed by
GitHub
4 changed files with 98 additions and 70 deletions
@ -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 }} |
||||||
|
|
@ -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 }} |
@ -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 }} |
|
Loading…
Reference in new issue