Create Release #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Release | |
| on: | |
| workflow_run: | |
| workflows: ["Build Desktop Packages"] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version number (e.g., 1.0.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| actions: read | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event.workflow_run.conclusion == 'success' && | |
| (github.event_name == 'workflow_dispatch' || | |
| github.event.workflow_run.event == 'push' || | |
| github.event.workflow_run.event == 'workflow_dispatch') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List downloaded artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find artifacts -type f | xargs ls -la | |
| - name: Get the version | |
| id: get-version | |
| run: | | |
| if [[ -n "${{ github.event.inputs.version }}" ]]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| # Get the latest tag or use a default version | |
| VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "version=${VERSION#v}" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Using version: $VERSION" | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.get-version.outputs.version }} | |
| release_name: Release v${{ steps.get-version.outputs.version }} | |
| body: | | |
| ### Changes | |
| - See commit history for details | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Assets | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./artifacts/**/* | |
| asset_name: Locky-v${{ steps.get-version.outputs.version }}.zip | |
| asset_content_type: application/zip | |
| - name: Show release info | |
| run: | | |
| echo "Release created at: ${{ steps.create_release.outputs.html_url }}" |