|
23 | 23 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
24 | 24 | echo "Extracted version: $VERSION" |
25 | 25 |
|
| 26 | + create-draft-release: |
| 27 | + name: Create Draft Release |
| 28 | + needs: [extract-version] |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: write |
| 32 | + outputs: |
| 33 | + release_id: ${{ steps.create_release.outputs.id }} |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout code |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Create Draft Release |
| 40 | + id: create_release |
| 41 | + uses: softprops/action-gh-release@v1 |
| 42 | + with: |
| 43 | + name: NetDriver Simunet ${{ needs.extract-version.outputs.version }} |
| 44 | + draft: true |
| 45 | + prerelease: false |
| 46 | + generate_release_notes: true |
| 47 | + body: | |
| 48 | + ## netdriver-simunet ${{ needs.extract-version.outputs.version }} |
| 49 | +
|
| 50 | + ### 📦 Package |
| 51 | +
|
| 52 | + **netdriver-simunet** - SSH server simulation for testing network device terminals |
| 53 | +
|
| 54 | + ### 🛠️ Preparation |
| 55 | +
|
| 56 | + ```bash |
| 57 | + # Create directories |
| 58 | + mkdir -p config/simunet logs |
| 59 | +
|
| 60 | + # Download default configuration |
| 61 | + curl -o config/simunet/simunet.yml https://raw.githubusercontent.com/${{ github.repository }}/master/config/simunet/simunet.yml |
| 62 | + ``` |
| 63 | +
|
| 64 | + ### 📥 Installation |
| 65 | +
|
| 66 | + **PyPI:** |
| 67 | + ```bash |
| 68 | + pip install netdriver-simunet==${{ needs.extract-version.outputs.version }} |
| 69 | + ``` |
| 70 | +
|
| 71 | + **Docker:** |
| 72 | + ```bash |
| 73 | + # Pull the image |
| 74 | + docker pull ghcr.io/opensecflow/netdriver-simunet:${{ needs.extract-version.outputs.version }} |
| 75 | +
|
| 76 | + # Run with host network mode |
| 77 | + docker run -d --network host \ |
| 78 | + -v $(pwd)/config:/app/config \ |
| 79 | + -v $(pwd)/logs:/app/logs \ |
| 80 | + ghcr.io/opensecflow/netdriver-simunet:${{ needs.extract-version.outputs.version }} |
| 81 | + ``` |
| 82 | +
|
| 83 | + **Available tags:** `${{ needs.extract-version.outputs.version }}`, `latest` |
| 84 | +
|
| 85 | + **Platforms:** `linux/amd64`, `linux/arm64` |
| 86 | +
|
| 87 | + ### 📝 Changes |
| 88 | +
|
| 89 | + See [CHANGELOG](https://github.com/OpenSecFlow/netdriver/blob/master/CHANGELOG.md) for detailed changes. |
| 90 | +
|
26 | 91 | test: |
27 | 92 | name: Run tests |
28 | 93 | runs-on: ubuntu-latest |
@@ -154,78 +219,60 @@ jobs: |
154 | 219 | cache-to: type=gha,mode=max |
155 | 220 | platforms: linux/amd64,linux/arm64 |
156 | 221 |
|
157 | | - create-release: |
158 | | - name: Create GitHub Release with Assets |
159 | | - needs: [extract-version, build-and-publish, build-docker-image] |
| 222 | + upload-assets: |
| 223 | + name: Upload Assets to Release |
| 224 | + needs: [extract-version, create-draft-release, build-and-publish, build-docker-image] |
160 | 225 | runs-on: ubuntu-latest |
161 | 226 | permissions: |
162 | 227 | contents: write |
163 | 228 |
|
164 | 229 | steps: |
165 | | - - name: Checkout code |
166 | | - uses: actions/checkout@v4 |
167 | | - |
168 | 230 | - name: Download wheel artifact |
169 | 231 | uses: actions/download-artifact@v4 |
170 | 232 | with: |
171 | 233 | name: simunet-wheel |
172 | 234 | path: ./dist |
173 | 235 |
|
174 | | - - name: Create Release |
| 236 | + - name: Upload wheel to release |
175 | 237 | uses: softprops/action-gh-release@v1 |
176 | 238 | with: |
177 | | - name: NetDriver Simunet ${{ needs.extract-version.outputs.version }} |
178 | | - draft: false |
179 | | - prerelease: false |
180 | | - generate_release_notes: true |
| 239 | + tag_name: simunet-${{ needs.extract-version.outputs.version }} |
181 | 240 | files: ./dist/*.whl |
182 | | - body: | |
183 | | - ## netdriver-simunet ${{ needs.extract-version.outputs.version }} |
184 | | -
|
185 | | - ### 📦 Package |
186 | | -
|
187 | | - **netdriver-simunet** - SSH server simulation for testing network device terminals |
188 | | -
|
189 | | - ### 🛠️ Preparation |
190 | | -
|
191 | | - ```bash |
192 | | - # Create directories |
193 | | - mkdir -p config/simunet logs |
194 | 241 |
|
195 | | - # Download default configuration |
196 | | - curl -o config/simunet/simunet.yml https://raw.githubusercontent.com/${{ github.repository }}/master/config/simunet/simunet.yml |
197 | | - ``` |
198 | | -
|
199 | | - ### 📥 Installation |
200 | | -
|
201 | | - **PyPI:** |
202 | | - ```bash |
203 | | - pip install netdriver-simunet==${{ needs.extract-version.outputs.version }} |
204 | | - ``` |
205 | | -
|
206 | | - **Docker:** |
207 | | - ```bash |
208 | | - # Pull the image |
209 | | - docker pull ghcr.io/opensecflow/netdriver-simunet:${{ needs.extract-version.outputs.version }} |
210 | | -
|
211 | | - # Run with host network mode |
212 | | - docker run -d --network host \ |
213 | | - -v $(pwd)/config:/app/config \ |
214 | | - -v $(pwd)/logs:/app/logs \ |
215 | | - ghcr.io/opensecflow/netdriver-simunet:${{ needs.extract-version.outputs.version }} |
216 | | - ``` |
217 | | -
|
218 | | - **Available tags:** `${{ needs.extract-version.outputs.version }}`, `latest` |
219 | | -
|
220 | | - **Platforms:** `linux/amd64`, `linux/arm64` |
221 | | -
|
222 | | - ### 📝 Changes |
| 242 | + publish-release: |
| 243 | + name: Publish Release |
| 244 | + needs: [extract-version, create-draft-release, upload-assets] |
| 245 | + runs-on: ubuntu-latest |
| 246 | + permissions: |
| 247 | + contents: write |
223 | 248 |
|
224 | | - See [CHANGELOG](https://github.com/OpenSecFlow/netdriver/blob/master/CHANGELOG.md) for detailed changes. |
| 249 | + steps: |
| 250 | + - name: Publish Release |
| 251 | + uses: actions/github-script@v7 |
| 252 | + with: |
| 253 | + script: | |
| 254 | + const tag = 'simunet-${{ needs.extract-version.outputs.version }}'; |
| 255 | +
|
| 256 | + // Get the release by tag |
| 257 | + const { data: release } = await github.rest.repos.getReleaseByTag({ |
| 258 | + owner: context.repo.owner, |
| 259 | + repo: context.repo.repo, |
| 260 | + tag: tag |
| 261 | + }); |
| 262 | +
|
| 263 | + // Update release to publish it |
| 264 | + await github.rest.repos.updateRelease({ |
| 265 | + owner: context.repo.owner, |
| 266 | + repo: context.repo.repo, |
| 267 | + release_id: release.id, |
| 268 | + draft: false |
| 269 | + }); |
| 270 | +
|
| 271 | + console.log(`Release ${tag} published successfully!`); |
225 | 272 |
|
226 | 273 | verify: |
227 | 274 | name: Verify publication |
228 | | - needs: [extract-version, build-and-publish, build-docker-image, create-release] |
| 275 | + needs: [extract-version, build-and-publish, build-docker-image, publish-release] |
229 | 276 | runs-on: ubuntu-latest |
230 | 277 |
|
231 | 278 | steps: |
|
0 commit comments