Skip to content

rust / ship

rust / ship #169

Workflow file for this run

name: rust / ship
on:
push:
branches: [main]
workflow_dispatch:
inputs:
release: # set to true to trigger a release
description: Trigger a release
required: false
default: 'false'
tag: # example: x.y.z-rc.w
description: Release tag
required: false
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
- os: macos-latest
target: x86_64-apple-darwin
cross: false
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --color always --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.cross }}
- name: Get Binary path
id: binary
run: echo "::set-output name=path::target/${{ matrix.target }}/release/three_em${{ runner.os == 'windows' && '.exe' || '' }}"
- name: Zip Builds
shell: pwsh
run: Compress-Archive -CompressionLevel Optimal -Force -Path ${{ steps.binary.outputs.path }}, README.md, LICENSE -DestinationPath three_em-${{ matrix.target }}.zip
- name: Upload Release Builds
uses: actions/upload-artifact@v2
with:
name: release
path: three_em-${{ matrix.target }}.zip
if-no-files-found: error
retention-days: 1
publish:
if: github.event.inputs.release == 'true' && github.event.inputs.tag != ''
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Download Builds
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.tag }}
name: v${{ github.event.inputs.tag }}
prerelease: contains(github.event.inputs.tag, '-')
discussionCategory: 'announcements'
draft: true
allowUpdates: true
replacesArtifacts: true
artifacts: 'artifacts/release/*.zip'
generateReleaseNotes: true
token: ${{ github.token }}