Skip to content

feat: remove support Intel Mac #51

feat: remove support Intel Mac

feat: remove support Intel Mac #51

Workflow file for this run

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@v3
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-musl
arch_name: linux_amd64
ext: tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
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 cross
if: runner.os == 'Linux'
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build release (Linux musl)
if: runner.os == 'Linux'
run: |
cross build --release --locked --target ${{ matrix.target }}
- name: Build release
if: runner.os != 'Linux'
run: |
cargo build --release --locked --target ${{ matrix.target }}
- name: Verify Linux binary is fully static
if: runner.os == 'Linux'
shell: bash
run: |
set -euxo pipefail
BIN="target/${{ matrix.target }}/release/sshpod"
readelf -d "$BIN" > dynamic-deps.txt
! grep -F "Shared library:" dynamic-deps.txt
readelf -l "$BIN" > program-headers.txt
! grep -F "Requesting program interpreter" program-headers.txt
- name: Verify dynamic dependencies (unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
BIN="target/${{ matrix.target }}/release/sshpod"
chmod +x ./scripts/check-dynamic-deps.sh
./scripts/check-dynamic-deps.sh "$BIN"
- 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@v3
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
draft: true
prerelease: false