CI: Add Release Job #13
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: Rust Binary Release | |
on: | |
push: | |
jobs: | |
build: | |
name: Build Rust Binary Releases | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Package Artifacts | |
run: | | |
mkdir artifacts | |
cp target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }} artifacts/ | |
# Zip artifacts for Windows | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
7z a artifacts.zip artifacts/ | |
else | |
tar -czvf artifacts.tar.gz artifacts/ | |
fi | |
shell: bash | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }} | |
path: ./artifacts.* | |
env: | |
PROJECT_NAME: quicssh | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
- name: Release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest | |
prerelease: false | |
title: Release | |
files: | | |
*.zip | |
*.tar.gz |