2022-11-04 12:25:20 +01:00

86 lines
2.7 KiB
YAML

name: Continuous Deployment
on:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
jobs:
publish-release:
name: Generating artifacts for ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
binary-postfix: ".exe"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.job.target }}
override: true
- uses: Swatinem/rust-cache@v1
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.job.cross }}
args: --release --target ${{ matrix.job.target }}
- name: Compress (Unix)
if: ${{ matrix.job.os != 'windows-latest' }}
run: zip -j espup-${{ matrix.job.target }}.zip target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }}
- name: Compress (Windows)
if: ${{ matrix.job.os == 'windows-latest' }}
run: Compress-Archive target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }} espup-${{ matrix.job.target }}.zip
- name: Upload compressed artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: espup-${{ matrix.job.target }}.zip
tag: ${{ github.ref }}
- name: Upload binary artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }}
asset_name: espup-${{ matrix.job.target }}${{ matrix.job.binary-postfix }}
tag: ${{ github.ref }}
# publish-cratesio:
# name: Publishing to Crates.io
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# override: true
# - uses: Swatinem/rust-cache@v1
# - uses: actions-rs/cargo@v1
# with:
# command: publish
# args: --token ${{ secrets.CARGO_API_KEY }}