diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6ed698..b2659b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,17 +7,22 @@ on: deploy_nuget_locally: type: boolean description: 🚀 deploy package to GH private - default: false + default: false push: branches: - 'main' + paths-ignore: + - '*.md' + pull_request: branches: - '*' + paths-ignore: + - '*.md' release: types: - published - + env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_NOLOGO: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b404604..20c2adf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,7 +3,9 @@ name: "CodeQL" on: workflow_dispatch: pull_request: - branches: [ main ] + branches: [ main ] + paths-ignore: + - '*.md' schedule: - cron: '40 16 * * 0' diff --git a/.github/workflows/license-scanning.yml b/.github/workflows/license-scanning.yml index 02aa885..fe81ba5 100644 --- a/.github/workflows/license-scanning.yml +++ b/.github/workflows/license-scanning.yml @@ -5,6 +5,8 @@ on: pull_request: branches: - '*' + paths-ignore: + - '*.md' run-name: "License Scanning" diff --git a/.github/workflows/update-release-notes.yml b/.github/workflows/update-release-notes.yml new file mode 100644 index 0000000..7989b70 --- /dev/null +++ b/.github/workflows/update-release-notes.yml @@ -0,0 +1,84 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: 'Update release notes history' +on: + release: + types: + - published + +defaults: + run: + shell: pwsh + +jobs: + update_notes: + name: 📜 update notes + runs-on: ubuntu-latest + steps: + - name: 🤘 checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 🗎 create release notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_NAME: ${{ github.event.release.name }} + RELEASE_BODY: ${{ github.event.release.body }} + run: | + $NL = "`r`n" + $name = $env:RELEASE_NAME + $body = $env:RELEASE_BODY + $releaseNumber = "${{ github.event.release.tag_name }}" + $publishedAt = [DateTime]::Parse("${{ github.event.release.published_at }}").ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss') + " GMT" + $url = "${{ github.event.release.html_url }}" + $authorLogin = "${{ github.event.release.author.login }}" + $authorUrl = "${{ github.event.release.author.html_url }}" + + $releaseNotes = "# Release $releaseNumber" + + if($name){ + $releaseNotes += " - $name" + } + $releaseNotes += $NL + + $releaseNotes += "Published [$publishedAt]($url) by [$authorLogin]($authorUrl)" + $NL + + if($body){ + $releaseNotes += "$NL$body" + } + + $releaseNotes += $NL + + $releaseNotes | Set-Content -Encoding UTF8 "ReleaseNotesFromLastRelease.md" + + - name: ⬆️ upload release notes + uses: actions/upload-artifact@v4 + with: + name: ReleaseNotes + if-no-files-found: error + retention-days: 7 + path: ReleaseNotesFromLastRelease.md + - name: 🚀 create pull request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git --version + git config user.name "GitHub Actions Bot" + git config user.email "<>" + + $releaseNumber = "${{ github.event.release.tag_name }}" + $branchName = "build/update-release-notes-$releaseNumber-$(Get-Date -Format "yyyyMMdd_HHmmss")" + + $lastReleaseNotes = Get-Content -Encoding UTF8 "ReleaseNotesFromLastRelease.md" -Raw + $lastReleaseNotes + (Get-Content .\ReleaseNotes.md -Raw -Encoding UTF8) | Set-Content .\ReleaseNotes.md -Encoding UTF8 + Remove-Item ReleaseNotesFromLastRelease.md + + $title = "Update release notes after release $releaseNumber" + + git checkout -b $branchName + git add . + git commit -m $title + git push --set-upstream origin $branchName + + gh pr create -B main -H $branchName --title $title --body 'Created by Github action' \ No newline at end of file diff --git a/Nemesis.TextParsers.sln b/Nemesis.TextParsers.sln index 194a02b..af46192 100644 --- a/Nemesis.TextParsers.sln +++ b/Nemesis.TextParsers.sln @@ -39,6 +39,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml .github\workflows\license-scanning.yml = .github\workflows\license-scanning.yml + .github\workflows\update-release-notes.yml = .github\workflows\update-release-notes.yml EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nemesis.TextParsers.DependencyInjection", "Nemesis.TextParsers.DependencyInjection\Nemesis.TextParsers.DependencyInjection.csproj", "{55D14092-BD6A-4076-A5D7-B9E5C57C8D67}"