267: Use gtar to create release archive on Mac r=thomaseizinger a=rishflab

Follow up commit uses 7zip to create a zip for windows and appends the binary with a .exe

Here are the releases produced by this PR on my fork:
https://github.com/rishflab/xmr-btc-swap/releases/tag/0.34.0
I have tested the above releases to work up to asking for a btc deposit on :
- [x] macOS
- [x] windows
- [ ] ubuntu

Fixes #251.

Co-authored-by: rishflab <rishflab@hotmail.com>
This commit is contained in:
bors[bot] 2021-03-04 03:47:03 +00:00 committed by GitHub
commit 6ae8b63018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 127 additions and 7 deletions

View File

@ -0,0 +1,38 @@
name: Create release archive
description: Creates a tar 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}.tar'
print(f'::set-output name=archive::{archive_name}')
- name: Make archive
shell: bash
run: gtar -C ./target/${{ inputs.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ inputs.binary }}

View File

@ -35,4 +35,4 @@ runs:
- name: Make archive
shell: bash
run: tar -C ./target/${{ inputs.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ inputs.binary }}
run: tar -C ./target/${{ inputs.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ inputs.binary }}

View 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

View File

@ -35,20 +35,62 @@ jobs:
with:
python-version: '3.x'
- name: Create release archive
id: create-archive
uses: ./.github/actions/create-release-archive
- 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: Upload ${{ matrix.os }} release binary
- 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.outputs.archive }}
asset_name: ${{ steps.create-archive.outputs.archive }}
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