Browse Source

Merge pull request #96 from ionite34/fix-version-ci-2

pull/5/head
Ionite 1 year ago committed by GitHub
parent
commit
3101460341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/build.yml
  2. 60
      .github/workflows/version-bump-pr.yml
  3. 36
      .github/workflows/version-bump.yml
  4. 68
      .github/workflows/versioning.yml

4
.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

60
.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 }}

36
.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 }}

68
.github/workflows/versioning.yml

@ -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…
Cancel
Save