xmr-btc-swap/.github/workflows/release-cli.yml
rishflab 13764161a3 Add create release archive action for windows
Windows users may not have a tar extractor installed by default so 7z
was used to create a zip archive. I attempted to add the action names to
 the strategy matrix so we dont need if statements to choose the
 appropriate create release archive action but github did not like when
 I passed a field under strategy.matrix.include into steps.uses.
2021-03-04 12:29:33 +11:00

75 lines
2.5 KiB
YAML

name: "Release swap_cli"
on:
release:
types: [created]
jobs:
release:
name: Release swap_cli
strategy:
matrix:
include:
- 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 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 release archive
id: create-archive
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
uses: ./.github/actions/create-release-archive
with:
binary: swap_cli
version: ${{ github.event.release.tag_name }}
target: ${{ matrix.target }}
- name: Upload ${{ matrix.os }} 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 ${{ matrix.os }} release binary
if: contains(matrix.os, 'macos') || 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.outputs.archive }}
asset_name: ${{ steps.create-archive.outputs.archive }}
asset_content_type: application/gzip