|
5 | 5 | branches: [ master, main ] |
6 | 6 | pull_request: |
7 | 7 | branches: [ master, main ] |
| 8 | + workflow_dispatch: |
8 | 9 |
|
9 | 10 | env: |
10 | 11 | BuildVersion: '10.0.0' |
11 | 12 |
|
12 | 13 | jobs: |
13 | | - build: |
| 14 | + build: |
14 | 15 | runs-on: windows-2022 |
15 | 16 | env: |
16 | 17 | BuildPlatform: Any CPU |
@@ -81,24 +82,48 @@ jobs: |
81 | 82 | name: ICSharpCode.CodeConverter.Func.${{ env.BuildVersion }}.zip |
82 | 83 | path: Func/bin/${{ env.BuildTarget }}/publish/ |
83 | 84 |
|
84 | | - deploy: |
85 | | - if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} |
86 | | - concurrency: ci-${{ github.ref }} |
87 | | - needs: [build] # The second job must depend on the first one to complete before running and uses ubuntu-latest instead of windows. |
88 | | - runs-on: ubuntu-latest |
89 | | - steps: |
90 | | - - name: Checkout 🛎️ |
91 | | - uses: actions/checkout@v4 |
| 85 | + deploy: |
| 86 | + if: ${{ github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }} |
| 87 | + concurrency: ci-${{ github.ref }} |
| 88 | + needs: [build] # The second job must depend on the first one to complete before running and uses ubuntu-latest instead of windows. |
| 89 | + runs-on: ubuntu-latest |
| 90 | + permissions: |
| 91 | + contents: write |
| 92 | + steps: |
| 93 | + - name: Checkout 🛎️ |
| 94 | + uses: actions/checkout@v4 |
92 | 95 |
|
93 | | - - name: Download Artifacts 🔻 # The built project is downloaded into the 'site' folder. |
94 | | - uses: actions/download-artifact@v4 |
95 | | - with: |
96 | | - name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip |
97 | | - path: site |
| 96 | + - name: Download Artifacts 🔻 # The built project is downloaded into the 'site' folder. |
| 97 | + uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip |
| 100 | + path: site |
| 101 | + |
| 102 | + - name: Download all release artifacts |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + path: release-artifacts |
| 106 | + |
| 107 | + - name: Extract latest changelog section |
| 108 | + id: changelog |
| 109 | + shell: pwsh |
| 110 | + run: | |
| 111 | + ./Get-LatestChangelog.ps1 -Path CHANGELOG.md | Tee-Object -FilePath release-notes.md |
| 112 | + "notes<<EOF" >> $env:GITHUB_OUTPUT |
| 113 | + Get-Content release-notes.md >> $env:GITHUB_OUTPUT |
| 114 | + "EOF" >> $env:GITHUB_OUTPUT |
98 | 115 | |
99 | | - - name: Deploy 🚀 |
100 | | - uses: JamesIves/github-pages-deploy-action@v4 |
101 | | - with: |
102 | | - branch: 'autoupdated/gh-pages' |
103 | | - folder: 'site/wwwroot' |
| 116 | + - name: Deploy 🚀 |
| 117 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 118 | + with: |
| 119 | + branch: 'autoupdated/gh-pages' |
| 120 | + folder: 'site/wwwroot' |
| 121 | + |
| 122 | + - name: Create GitHub release |
| 123 | + uses: softprops/action-gh-release@v2 |
| 124 | + with: |
| 125 | + tag_name: v${{ env.BuildVersion }}.${{ github.run_number }} |
| 126 | + name: v${{ env.BuildVersion }}.${{ github.run_number }} |
| 127 | + body: ${{ steps.changelog.outputs.notes }} |
| 128 | + files: release-artifacts/** |
104 | 129 |
|
0 commit comments