chore(deps): update rust crate clap to v4.5.56 #552
Workflow file for this run
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: Finish Knope release | |
| on: | |
| pull_request: | |
| types: [ closed ] | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Manual release tag name (e.g., knope/v1.2.3). Leave empty to auto-detect from draft release.' | |
| required: false | |
| type: string | |
| permissions: {} | |
| jobs: | |
| get-tag: | |
| if: (github.head_ref == 'knope/release' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Get tag name | |
| id: get-tag | |
| run: | | |
| # Use manual input if provided, otherwise auto-detect from draft releases | |
| if [ -n "$MANUAL_TAG_NAME" ]; then | |
| echo "Using manual tag name: $MANUAL_TAG_NAME" | |
| echo "tag_name=$MANUAL_TAG_NAME" >> $GITHUB_OUTPUT | |
| else | |
| echo "Auto-detecting tag from draft releases..." | |
| TAG_NAME=$(gh release list --repo "$GITHUB_REPOSITORY" --json 'isDraft,tagName' --jq '.[] | select(.isDraft) | .tagName' | head -1) | |
| if [ -z "$TAG_NAME" ]; then | |
| echo "Error: No draft release found and no manual tag provided" | |
| exit 1 | |
| fi | |
| echo "Found draft release: $TAG_NAME" | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MANUAL_TAG_NAME: ${{ inputs.tag_name }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| outputs: | |
| tag_name: ${{ steps.get-tag.outputs.tag_name }} | |
| build-artifacts: | |
| needs: [get-tag] | |
| if: needs.get-tag.outputs.tag_name != '' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.target }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| with: | |
| target: ${{ matrix.target }} | |
| - name: Install musl-tools | |
| if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} | |
| run: sudo apt-get install -y musl-tools | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Set Archive Name (Non-Windows) | |
| id: archive | |
| run: echo "archive_name=knope-${{ matrix.target }}" >> $GITHUB_ENV | |
| - name: Set Archive Name (Windows) | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: echo "archive_name=knope-${{ matrix.target }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Create Archive Folder | |
| run: mkdir ${{ env.archive_name }} | |
| - name: Copy Unix Artifact | |
| if: ${{ matrix.os != 'windows-latest' }} | |
| run: cp target/${{ matrix.target }}/release/knope ${{ env.archive_name }} | |
| - name: Copy Windows Artifact | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: cp target/${{ matrix.target }}/release/knope.exe ${{ env.archive_name }} | |
| - name: Create Tar Archive | |
| run: tar -czf ${{ env.archive_name }}.tgz ${{ env.archive_name }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: ${{ env.archive_name }}.tgz | |
| if-no-files-found: error | |
| release: | |
| needs: [build-artifacts, get-tag] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Upload artifacts to release | |
| run: | | |
| cd artifacts | |
| gh release upload --repo "$GITHUB_REPOSITORY" "$TAG_NAME" * | |
| gh release edit --repo "$GITHUB_REPOSITORY" "$TAG_NAME" --draft=false --latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: ${{ needs.get-tag.outputs.tag_name }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} |