Skip to content

Commit

Permalink
👻 Add workflow to upload binaries to releases (#182)
Browse files Browse the repository at this point in the history
* 👻 add workflow to upload binaries to releases

Signed-off-by: Pranav Gaikwad <[email protected]>

* 👻 wait for image to publish

Signed-off-by: Pranav Gaikwad <[email protected]>

* 👻 use manual trigger

Signed-off-by: Pranav Gaikwad <[email protected]>

---------

Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad authored Mar 20, 2024
1 parent 8c6ee6f commit 6a5750a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 3 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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

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 }}
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

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ COPY pkg/ pkg/
# Build
ARG VERSION
ARG BUILD_COMMIT
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o kantra main.go
RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o darwin-kantra main.go
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o windows-kantra main.go
RUN CGO_ENABLED=0 GOOS=linux go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o kantra main.go
RUN CGO_ENABLED=0 GOOS=darwin go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o darwin-kantra main.go
RUN CGO_ENABLED=0 GOOS=windows go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o windows-kantra main.go

FROM quay.io/konveyor/analyzer-lsp:latest

Expand Down

0 comments on commit 6a5750a

Please sign in to comment.