xmr-btc-swap/.github/workflows/release-cli.yml
rishflab 95b1558c8e Add create release archive action for ubuntu
gtar is not installed on ubuntu so tar has to be used
2021-03-04 12:29:35 +11:00

97 lines
3.3 KiB
YAML

name: "Release swap_cli"
on:
release:
types: [created]
jobs:
release:
name: Release swap_cli
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tagged commit
uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
- name: Build ${{ matrix.target }} release binary
run: cargo build --target=${{ matrix.target }} --release --package swap --bin swap_cli
- name: Smoke test the binary
run: target/${{ matrix.target }}/release/swap_cli --help
# Remove once python 3 is the default
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Create windows release archive
id: create-archive-windows
if: contains(matrix.os, 'windows')
uses: ./.github/actions/create-release-archive/windows
with:
binary: swap_cli
version: ${{ github.event.release.tag_name }}
target: ${{ matrix.target }}
- name: Create macos release archive
id: create-archive-macos
if: contains(matrix.os, 'macos')
uses: ./.github/actions/create-release-archive/macos
with:
binary: swap_cli
version: ${{ github.event.release.tag_name }}
target: ${{ matrix.target }}
- name: Create ubuntu release archive
id: create-archive-ubuntu
if: contains(matrix.os, 'ubuntu')
uses: ./.github/actions/create-release-archive/ubuntu
with:
binary: swap_cli
version: ${{ github.event.release.tag_name }}
target: ${{ matrix.target }}
- name: Upload windows release binary
if: contains(matrix.os, 'windows')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.create-archive-windows.outputs.archive }}
asset_name: ${{ steps.create-archive-windows.outputs.archive }}
asset_content_type: application/gzip
- name: Upload macos release binary
if: contains(matrix.os, 'macos')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.create-archive-macos.outputs.archive }}
asset_name: ${{ steps.create-archive-macos.outputs.archive }}
asset_content_type: application/gzip
- name: Upload ubuntu release binary
if: contains(matrix.os, 'ubuntu')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.create-archive-ubuntu.outputs.archive }}
asset_name: ${{ steps.create-archive-ubuntu.outputs.archive }}
asset_content_type: application/gzip