Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 72 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,80 @@
# .github/workflows/release.yml
name: release-artifacts
name: Publish Release

on:
release:
types: [created]
push:
tags:
- 'v*'

jobs:
release:
name: release ${{ matrix.target }}
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Generate Changelog
id: changelog
run: |
prev_tag=$(git describe --abbrev=0 --tags ${{ github.ref }}^)
log=$(git log --oneline --decorate=no $prev_tag..${{ github.ref }})
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=value::$log"
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.value }}
draft: false
prerelease: false

build-release:
needs: create-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz
- target: x86_64-apple-darwin
archive: zip
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/rust-build.action@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: 1.59.0
targets: ${{ matrix.target }}
- name: Install Musl
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
sudo apt-get install -y musl-tools
cat << 'EOF' | sudo tee /usr/bin/cross
#!/bin/sh
cargo $@
EOF
sudo chmod +x /usr/bin/cross
- name: Install Cross
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' }}
run: cargo install cross
- name: Build
run: |
cross build --release --target=${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/ck_cli ck-cli-${{ matrix.target }}
cross build --release --target=${{ matrix.target }} --no-default-features --features=native-tls
mv ./target/${{ matrix.target }}/release/ck_cli ck-cli-${{ matrix.target }}-openssl
- name: Upload Release Asset
id: upload-release-asset
uses: iovxw/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_files: "ck-cli-*"