support alternate architectures and improve error println #60
Workflow file for this run
This file contains 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: CI and CD | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
workflow_dispatch: | |
inputs: | |
should_publish: | |
description: "whether to publish the release (yes/no)" | |
required: true | |
default: "no" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
name: "Run linters" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run linters | |
run: make lint | |
build-pam-module: | |
name: "Build PAM module" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
override: true | |
- name: Enable Rust cache | |
uses: Swatinem/rust-cache@v1 | |
- name: Install libpam | |
run: sudo apt-get install libpam0g-dev | |
- name: Build | |
run: make clean build/pam_wsl_hello.so | |
- uses: actions/upload-artifact@v2 | |
name: Upload artifact | |
with: | |
name: "PAM module" | |
path: build/pam_wsl_hello.so | |
if-no-files-found: error | |
build-windows-binary: | |
name: "Build Windows binary" | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build | |
run: make clean build/WindowsHelloBridge.exe | |
- uses: actions/upload-artifact@v2 | |
name: Upload artifacts | |
with: | |
name: "Windows Binary" | |
path: build/WindowsHelloBridge.exe | |
if-no-files-found: error | |
release: | |
name: "Release" | |
runs-on: ubuntu-latest | |
needs: [build-pam-module, build-windows-binary] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: "Windows Binary" | |
path: build | |
- uses: actions/download-artifact@v2 | |
with: | |
name: "PAM module" | |
path: build | |
- name: Conventional Changelog Action | |
if: ${{ github.event.inputs.should_publish == 'yes' }} | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v3 | |
with: | |
github-token: ${{ secrets.github_token }} | |
version-file: ./wsl_hello_pam/Cargo.toml,./win_hello_bridge/Cargo.toml | |
version-path: package.version | |
skip-on-empty: false | |
git-user-name: "github-actions[bot]" | |
git-user-email: "41898282+github-actions[bot]@users.noreply.github.com" | |
release-count: "0" | |
- name: Create Release asset | |
id: create_asset | |
env: | |
release_name: release | |
run: | | |
make -d release RELEASE="$release_name" | |
echo "::set-output name=release_asset::$release_name.tar.gz" | |
- uses: actions/upload-artifact@v2 | |
if: ${{ github.event.inputs.should_publish != 'yes' }} | |
name: Upload the release asset (CI) | |
with: | |
name: ${{ steps.create_asset.outputs.release_asset }} | |
path: ${{ steps.create_asset.outputs.release_asset }} | |
if-no-files-found: error | |
- name: Create Release | |
if: ${{ github.event.inputs.should_publish == 'yes' }} | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
with: | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
release_name: ${{ steps.changelog.outputs.tag }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
- name: Upload Release Asset | |
if: ${{ github.event.inputs.should_publish == 'yes' }} | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.create_asset.outputs.release_asset }} | |
asset_name: ${{ steps.create_asset.outputs.release_asset }} | |
asset_content_type: application/gzip |