|
26 | 26 | os: [windows-latest, ubuntu-latest] |
27 | 27 |
|
28 | 28 | steps: |
29 | | - - uses: actions/checkout@v4 |
30 | | - with: |
31 | | - submodules: true |
| 29 | + - name: Fetch sources |
| 30 | + uses: actions/checkout@v4 |
32 | 31 |
|
33 | 32 | # Cache AUI boot directory |
34 | 33 | - name: Cache AUI.BOOT deps |
@@ -98,63 +97,39 @@ jobs: |
98 | 97 | name: ${{ matrix.os }} |
99 | 98 |
|
100 | 99 |
|
101 | | - release: |
| 100 | + release-draft: |
102 | 101 | runs-on: ubuntu-latest |
103 | 102 | permissions: write-all |
104 | | - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
105 | | - name: "Create release page" |
| 103 | + if: github.event_name != 'pull_request' |
| 104 | + needs: [ build-desktop ] |
| 105 | + name: "Release draft" |
106 | 106 | steps: |
107 | | - - name: Retrieve version |
108 | | - if: ${{ contains(github.ref, 'tags/v') }} |
109 | | - run: | |
110 | | - echo "TAG_NAME=${{ github.ref }} " >> $GITHUB_ENV |
111 | | - echo "RELEASE_NAME=${{ github.ref }} " >> $GITHUB_ENV |
| 107 | + - name: Fetch sources |
| 108 | + uses: actions/checkout@v4 |
112 | 109 |
|
113 | | - - name: Output version |
114 | | - id: version |
| 110 | + - name: Extract version |
| 111 | + run: | |
| 112 | + VERSION=$(grep -Po '[0-9\.]+ (?=# CI_PROJECT_VERSION)' CMakeLists.txt) |
| 113 | + echo "VERSION=$VERSION" >> $GITHUB_ENV |
| 114 | + echo "VERSION = $VERSION" |
| 115 | + |
| 116 | + # Remove old release drafts |
| 117 | + - name: Remove Old Release Drafts |
| 118 | + env: |
| 119 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
115 | 120 | run: | |
116 | | - echo "ref=$TAG_NAME" >> $GITHUB_OUTPUT |
| 121 | + gh api repos/{owner}/{repo}/releases \ |
| 122 | + --jq '.[] | select(.draft == true) | .id' \ |
| 123 | + | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} |
117 | 124 |
|
118 | | - - name: Create Release |
119 | | - id: create_release |
120 | | - |
| 125 | + - name: Create Release Draft |
121 | 126 | env: |
122 | 127 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
123 | | - with: |
124 | | - tag_name: ${{ env.TAG_NAME }} |
125 | | - release_name: ${{ env.RELEASE_NAME }} |
126 | | - draft: false |
127 | | - prerelease: true |
| 128 | + run: | |
| 129 | + gh release create "v${{ env.VERSION }}" \ |
| 130 | + --draft \ |
| 131 | + --title "v${{ env.VERSION }}" |
| 132 | +
|
128 | 133 | outputs: |
129 | 134 | upload_url: ${{ steps.create_release.outputs.upload_url }} |
130 | 135 | ref: ${{ steps.version.outputs.ref }} |
131 | | - |
132 | | - publish: |
133 | | - name: Publish ${{ matrix.os }} |
134 | | - runs-on: ubuntu-latest |
135 | | - needs: [build-desktop, release] |
136 | | - strategy: |
137 | | - fail-fast: false |
138 | | - matrix: |
139 | | - os: [windows-latest, ubuntu-latest] |
140 | | - |
141 | | - steps: |
142 | | - - name: Download artifact |
143 | | - uses: actions/download-artifact@v4 |
144 | | - with: |
145 | | - path: ./ |
146 | | - name: ${{ matrix.os }} |
147 | | - |
148 | | - - id: getfilename |
149 | | - run: echo "::set-output name=file::$(ls *)" |
150 | | - |
151 | | - - name: Upload to Release |
152 | | - id: upload_to_release |
153 | | - |
154 | | - env: |
155 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
156 | | - with: |
157 | | - upload_url: ${{ needs.release.outputs.upload_url }} |
158 | | - asset_path: ${{ steps.getfilename.outputs.file }} |
159 | | - asset_name: ${{ steps.getfilename.outputs.file }} |
160 | | - asset_content_type: application/x-gtar |
0 commit comments