Skip to content

workflow updates

workflow updates #80

Workflow file for this run

name: release
on:
pull_request:
branches: ["main"]
push:
# Run on release and preview tags
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"
jobs:
build-compiler:
timeout-minutes: 10
strategy:
matrix:
include:
- os: macos-11
target: x86_64-apple-darwin
compiler-exe: slicec-cs
- os: macos-11
target: aarch64-apple-darwin
compiler-exe: slicec-cs
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
compiler-exe: slicec-cs
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
compiler-exe: slicec-cs
- os: windows-2022
target: x86_64-pc-windows-msvc
compiler-exe: slicec-cs.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
uses: ./.github/actions/build-compiler
with:
cargo-build-args: --release
target: ${{ matrix.target }}
env:
# TODO remove once slicec repository is public
SLICEC_DEPLOY_KEY: ${{ secrets.SLICEC_DEPLOY_KEY }}
- name: Archive Build
uses: actions/upload-artifact@v3
with:
name: slicec-cs-${{ matrix.target }}
path: tools/slicec-cs/target/${{ matrix.target }}/release/${{ matrix.compiler-exe }}
build-packages:
runs-on: windows-2022
timeout-minutes: 10
needs: build-compiler
env:
SIGN_CERTIFICATE: ${{ github.workspace }}\certificate.pfx
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
SignTool: C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64\signtool.exe
steps:
- uses: actions/checkout@v3
- name: Create Code Signing Certificate
run: |
Set-Content -Path $env:GITHUB_WORKSPACE\certificate.pfx.base64 -Value '${{ secrets.SIGN_CERTIFICATE }}'
certutil -decode $env:GITHUB_WORKSPACE\certificate.pfx.base64 $env:GITHUB_WORKSPACE\certificate.pfx
Remove-Item $env:GITHUB_WORKSPACE\certificate.pfx.base64
- name: Download slicec-cs compiler artifacts
uses: actions/download-artifact@v3
- name: Set version from tag
run: echo "VERSION=$($env:GITHUB_REF.TrimStart('refs/tags/v'))" >> $env:GITHUB_ENV
- name: Copy slicec-cs binaries to staging path
run: |
@("macos-x64", "macos-arm64", "linux-x64", "linux-arm64", "windows-x64") | ForEach-Object { New-Item -ItemType Directory -Path $env:GITHUB_WORKSPACE\tools\slicec-cs\staging -Name $_ }
Copy-Item "slicec-cs-x86_64-apple-darwin\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\macos-x64"
Copy-Item "slicec-cs-aarch64-apple-darwin\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\macos-arm64"
Copy-Item "slicec-cs-x86_64-unknown-linux-gnu\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\linux-x64"
Copy-Item "slicec-cs-aarch64-unknown-linux-gnu\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\linux-arm64"
Copy-Item "slicec-cs-x86_64-pc-windows-msvc\slicec-cs.exe" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\windows-x64"
# Copy the compiler to the expected location to avoid rebuilding it when creating the NuGet packages
New-Item -ItemType Directory -Path "$env:GITHUB_WORKSPACE\tools\slicec-cs\target\release"
Copy-Item "slicec-cs-x86_64-pc-windows-msvc\slicec-cs.exe" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\target\release"
- name: Pack IceRPC Slice Tools
working-directory: tools/IceRpc.Slice.Tools
run: dotnet pack --configuration Release --output ../../
env:
SLICEC_CS_STAGING_PATH: ${{ github.workspace }}\tools\slicec-cs\staging
- name: Pack IceRPC
run: dotnet pack --configuration Release --output .
- name: Pack IceRPC Templates
working-directory: src/IceRpc.Templates
run: dotnet pack --configuration Release --output ../../
- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: packages
path: |
./*.nupkg
./*.snupkg
- name: Cleanup
if: always()
run: Remove-Item $env:GITHUB_WORKSPACE\certificate.pfx -ErrorAction SilentlyContinue