Skip to content

Commit

Permalink
Install rustup on self-hosted runners and tweak conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
timrogers committed Nov 30, 2024
1 parent baf2eb4 commit 95e986d
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,37 @@ jobs:
- {
target: x86_64-unknown-linux-gnu,
binary_name: linux-amd64,
os: ubuntu-latest,
runs_on: ubuntu-latest,
}
- {
target: aarch64-unknown-linux-gnu,
binary_name: linux-aarch64,
os: self-hosted,
runs_on: self-hosted,
}
- {
target: x86_64-apple-darwin,
binary_name: darwin-amd64,
os: macos-latest,
runs_on: macos-latest,
}
- {
target: aarch64-apple-darwin,
binary_name: darwin-aarch64,
os: macos-latest,
runs_on: macos-latest,
}
- {
target: x86_64-pc-windows-msvc,
binary_name: windows-amd64.exe,
os: windows-latest,
runs_on: windows-latest,
}
runs-on: ${{ matrix.job.os }}
runs-on: ${{ matrix.job.runs_on }}
steps:
- uses: actions/checkout@v4
- name: Install libudev-dev
run: sudo apt-get update && sudo apt-get install libudev-dev
if: matrix.job.os == 'ubuntu-latest' || matrix.job.os == 'self-hosted'
if: runner.os == 'Ubuntu'
- name: Install rustup (self-hosted runners only)
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
if: matrix.job.runs_on == 'self-hosted'
- uses: Swatinem/rust-cache@v2
- name: Build in release mode
run: cargo build --release --target=${{ matrix.job.target }}
Expand All @@ -59,12 +62,12 @@ jobs:
env:
APPLE_SIGNING_KEY_P12: ${{ secrets.APPLE_SIGNING_KEY_P12 }}
run: echo "$APPLE_SIGNING_KEY_P12" | base64 -d -o key.p12
if: matrix.job.os == 'macos-latest'
if: runner.os == 'macOS'
- name: Write App Store Connect API key to a file (macOS only)
env:
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
run: echo "$APP_STORE_CONNECT_API_KEY" > app_store_connect_api_key.json
if: matrix.job.os == 'macos-latest'
if: runner.os == 'macOS'
- name: Sign macOS binary (macOS only)
uses: indygreg/apple-code-sign-action@v1
with:
Expand All @@ -73,23 +76,23 @@ jobs:
p12_password: ${{ secrets.APPLE_SIGNING_KEY_PASSWORD }}
sign: true
sign_args: "--code-signature-flags=runtime"
if: matrix.job.os == 'macos-latest'
if: runner.os == 'macOS'
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
path: litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }}
name: litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }}
- name: Archive macOS binary for notarisation (macOS only)
run: zip litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }}.zip litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }}
if: matrix.job.os == 'macos-latest'
if: runner.os == 'macOS'
- name: Notarise signed macOS binary (macOS only)
uses: indygreg/apple-code-sign-action@v1
with:
input_path: litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }}.zip
sign: false
notarize: true
app_store_connect_api_key_json_file: app_store_connect_api_key.json
if: matrix.job.os == 'macos-latest'
if: runner.os == 'macOS'
create_and_sign_macos_universal_binary:
name: Create and sign macOS universal binary (macOS only)
runs-on: macos-latest
Expand Down

0 comments on commit 95e986d

Please sign in to comment.