name: Release
on:
push:
jobs:
release:
name: giton-release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/v')"
continue-on-error: true
outputs:
upload_url: ${{ steps.automatic-release.outputs.upload_url }}
steps:
- id: automatic-release
uses: "marvinpinto/action-automatic-releases@v1.2.1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ github.ref_name }}"
title: "giton-${{ github.ref_name }}"
draft: true
prerelease: false
build-release:
name: giton-cli
needs: [release]
runs-on: ${{matrix.os}}
env:
CARGO: cargo
TARGET_FLAGS: ""
TARGET_DIR: ./target
RUST_BACKTRACE: 1
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
arch: x86_64
os: ubuntu-20.04
rust: stable
toolchain: 1.74.0
target: x86_64-unknown-linux-gnu
extension: ""
- build: macos
arch: x86_64
os: macos-latest
rust: stable
toolchain: 1.74.0
target: x86_64-apple-darwin
extension: ""
- build: windows
arch: x86_64
os: windows-latest
rust: stable
toolchain: 1.74.0
target: x86_64-pc-windows-msvc
extension: ".exe"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- name: install Linux dependencies
if: contains(matrix.target, 'unknown-linux')
run: |
sudo apt-get update
- name: build
run: cargo build --target ${{ matrix.target }} --release
- name: Upload artifact
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: "target/${{ matrix.target }}/release/giton${{ matrix.extension }}"
asset_name: "giton-${{ matrix.arch }}-${{ matrix.build }}"
asset_content_type: application/octet-stream