feat: warn if hostspec misses "--" (#4) #11
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g. 0.2.0)" | |
| required: true | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| create_release: | |
| if: github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Compute tag | |
| id: tag | |
| run: echo "tag=v${{ inputs.version }}" >> "$GITHUB_OUTPUT" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: sshpod ${{ inputs.version }} | |
| draft: true | |
| prerelease: false | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| arch_name: linux_amd64 | |
| ext: tar.gz | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| arch_name: linux_arm64 | |
| ext: tar.gz | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| arch_name: darwin_arm64 | |
| ext: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| arch_name: windows_amd64 | |
| ext: zip | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| arch_name: windows_arm64 | |
| ext: zip | |
| env: | |
| VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.sha }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install aarch64 linux toolchain | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Configure aarch64 linux linker | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| mkdir -p .cargo | |
| cat > .cargo/config.toml <<'EOF' | |
| [target.aarch64-unknown-linux-gnu] | |
| linker = "aarch64-linux-gnu-gcc" | |
| ar = "aarch64-linux-gnu-ar" | |
| EOF | |
| echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | |
| echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> "$GITHUB_ENV" | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | |
| - name: Build release | |
| run: | | |
| cargo build --release --locked --target ${{ matrix.target }} | |
| - name: Package (unix) | |
| if: runner.os != 'Windows' | |
| id: package_unix | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| BIN_NAME="sshpod" | |
| BIN="target/${{ matrix.target }}/release/${BIN_NAME}" | |
| ARTIFACT_DIR=artifact | |
| mkdir -p "$ARTIFACT_DIR" | |
| cp "$BIN" "$ARTIFACT_DIR/" | |
| ASSET="sshpod_${VERSION}_${{ matrix.arch_name }}.${{ matrix.ext }}" | |
| (cd "$ARTIFACT_DIR" && tar czf "../$ASSET" .) | |
| echo "asset_path=$ASSET" >> "$GITHUB_OUTPUT" | |
| - name: Package (windows) | |
| if: runner.os == 'Windows' | |
| id: package_windows | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $BinName = "sshpod" | |
| $Bin = "target/${{ matrix.target }}/release/${BinName}.exe" | |
| $ArtifactDir = "artifact" | |
| New-Item -ItemType Directory -Force -Path $ArtifactDir | Out-Null | |
| Copy-Item $Bin -Destination $ArtifactDir | |
| $Asset = "sshpod_${env:VERSION}_${{ matrix.arch_name }}.${{ matrix.ext }}" | |
| Compress-Archive -Path "$ArtifactDir\*" -DestinationPath $Asset -Force | |
| "asset_path=$Asset" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.package_unix.outputs.asset_path || steps.package_windows.outputs.asset_path }} | |
| path: ${{ steps.package_unix.outputs.asset_path || steps.package_windows.outputs.asset_path }} | |
| upload_release_assets: | |
| if: github.event_name == 'workflow_dispatch' | |
| needs: | |
| - create_release | |
| - build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch_name: linux_amd64 | |
| ext: tar.gz | |
| - arch_name: linux_arm64 | |
| ext: tar.gz | |
| - arch_name: darwin_arm64 | |
| ext: tar.gz | |
| - arch_name: windows_amd64 | |
| ext: zip | |
| - arch_name: windows_arm64 | |
| ext: zip | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sshpod_${{ env.VERSION }}_${{ matrix.arch_name }}.${{ matrix.ext }} | |
| path: artifacts | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| files: artifacts/sshpod_${{ env.VERSION }}_${{ matrix.arch_name }}.${{ matrix.ext }} | |
| fail_on_unmatched_files: true |