@@ -3,15 +3,12 @@ name: CI/CD Pipeline
33on : [push, pull_request, workflow_dispatch]
44
55permissions :
6- contents : write
6+ contents : read
77
88jobs :
99 ci :
1010 name : Continuous Integration
1111 runs-on : ubuntu-latest
12- outputs :
13- latest_version : ${{ steps.tag_generator.outputs.new_version }}
14- is_default_branch : ${{ steps.conditionals_handler.outputs.is_default_branch }}
1512 env :
1613 ARTIFACTS_FOLDER : ${{ github.workspace }}/Artifacts
1714 GITHUB_RUN_NUMBER : ${{ github.run_number }}
@@ -21,43 +18,13 @@ jobs:
2118 with :
2219 dotnet-version : 8.0.x
2320
24- - name : Data gatherer
25- id : data_gatherer
26- shell : pwsh
27- run : |
28- # Get default branch
29- $repo = 'microsoft/OpenAPI.NET'
30- $defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch
31- Write-Output "::set-output name=default_branch::$(echo $defaultBranch)"
32-
33- - name : Conditionals handler
34- id : conditionals_handler
35- shell : pwsh
36- run : |
37- $defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}"
38- $githubRef = "${{ github.ref }}"
39- $isDefaultBranch = 'false'
40- if ( $githubRef -like "*$defaultBranch*" ) {
41- $isDefaultBranch = 'true'
42- }
43- Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)"
44-
4521 - name : Checkout repository
4622 id : checkout_repo
4723 uses : actions/checkout@v4
4824 with :
4925 token : ${{ secrets.GITHUB_TOKEN }}
5026 fetch-depth : 0
5127
52- - if : steps.conditionals_handler.outputs.is_default_branch == 'true'
53- name : Bump GH tag
54- id : tag_generator
55- uses :
mathieudutour/[email protected] 56- with :
57- github_token : ${{ secrets.GITHUB_TOKEN }}
58- default_bump : false
59- release_branches : ${{ steps.data_gatherer.outputs.default_branch }}
60-
6128 - name : Build projects
6229 id : build_projects
6330 shell : pwsh
0 commit comments