Upload binaries to release assets #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this workflow makes sure we upload kantra binaries to release assets | |
name: "Upload binaries to release assets" | |
on: | |
workflow_dispatch: | |
inputs: | |
use_latest_release: | |
type: boolean | |
default: true | |
description: Upload binaries to the most recent release | |
tag_pattern: | |
type: string | |
default: 'v*' | |
description: Pick from tags matching this pattern | |
pre_release: | |
type: boolean | |
description: Look for pre-release? | |
default: false | |
jobs: | |
resolve-and-upload: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
arch: ["amd64", "arm64"] | |
os: ["ubuntu-latest"] | |
steps: | |
- id: release_info | |
uses: joutvhu/get-release@v1 | |
with: | |
latest: ${{ github.event.inputs.use_latest_release }} | |
tag_pattern: ${{ github.event.inputs.tag_pattern }} | |
prerelease: ${{ github.event.inputs.pre_release }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract binaries | |
run: | | |
image=quay.io/konveyor/kantra:${{ steps.release_info.outputs.tag_name }} | |
podman create --name kantra-download ${image} | |
podman cp kantra-download:/usr/local/bin/kantra . && zip kantra.linux.${{ matrix.arch }}.zip kantra | |
podman cp kantra-download:/usr/local/bin/darwin-kantra . && zip kantra.darwin.${{ matrix.arch }}.zip darwin-kantra | |
podman cp kantra-download:/usr/local/bin/windows-kantra windows-kantra.exe && zip kantra.windows.${{ matrix.arch }}.zip windows-kantra.exe | |
- name: Upload linux binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release_info.outputs.upload_url }} | |
asset_path: ./kantra.linux.${{ matrix.arch }}.zip | |
asset_name: kantra.linux.${{ matrix.arch }}.zip | |
asset_content_type: application/zip | |
- name: Upload windows binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release_info.outputs.upload_url }} | |
asset_path: ./kantra.windows.${{ matrix.arch }}.zip | |
asset_name: kantra.windows.${{ matrix.arch }}.zip | |
asset_content_type: application/zip | |
- name: Upload darwin binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release_info.outputs.upload_url }} | |
asset_path: ./kantra.darwin.${{ matrix.arch }}.zip | |
asset_name: kantra.darwin.${{ matrix.arch }}.zip | |
asset_content_type: application/zip | |