mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
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.
This commit is contained in:
parent
d88a235883
commit
13764161a3
40
.github/actions/create-release-archive-windows/action.yml
vendored
Normal file
40
.github/actions/create-release-archive-windows/action.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
name: Create release archive
|
||||
description: Creates a zip archive for a release binary
|
||||
inputs:
|
||||
version:
|
||||
description: 'The version of the binary'
|
||||
required: true
|
||||
binary:
|
||||
description: 'The name of the binary to pack into the archive'
|
||||
required: true
|
||||
target:
|
||||
description: 'The target triple, used to find the binary; pass it if the compilation was done with the `--target` argument'
|
||||
required: false
|
||||
outputs:
|
||||
archive:
|
||||
description: 'The name of the archive'
|
||||
value: ${{ steps.create-archive-name.outputs.archive }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- id: create-archive-name
|
||||
shell: python # Use python to have a prettier name for the archive on Windows.
|
||||
run: |
|
||||
import platform
|
||||
os_info = platform.uname()
|
||||
|
||||
arch = os_info.machine
|
||||
|
||||
if "${{ inputs.target }}":
|
||||
triple = "${{ inputs.target }}".split("-")
|
||||
arch = triple[0]
|
||||
|
||||
archive_name=f'${{ inputs.binary }}_${{ inputs.version }}_{os_info.system}_{arch}.zip'
|
||||
|
||||
print(f'::set-output name=archive::{archive_name}')
|
||||
|
||||
- name: Make archive
|
||||
shell: bash
|
||||
run: |
|
||||
cp -p ./target/${{ matrix.target }}/release/${{ inputs.binary }} ${{ inputs.binary }}.exe
|
||||
7z a -tzip ${{ steps.create-archive-name.outputs.archive }} ${{ inputs.binary }}.exe
|
24
.github/workflows/release-cli.yml
vendored
24
.github/workflows/release-cli.yml
vendored
@ -12,6 +12,8 @@ jobs:
|
||||
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
|
||||
@ -31,8 +33,18 @@ jobs:
|
||||
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
|
||||
@ -40,6 +52,18 @@ jobs:
|
||||
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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user