Skip to content

Commit

Permalink
Added Github CI to build & upload binaries & templates to the release
Browse files Browse the repository at this point in the history
Signed-off-by: Aravinda Vishwanathapura <[email protected]>
  • Loading branch information
aravindavk committed Feb 7, 2023
1 parent 77c777e commit 69f453f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/on-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "On Release"

on:
push:
# Publish `1.2.3` tags as releases.
tags:
- "*"

# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
release_amd64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Binnacle
run: |
curl -fsSL https://github.com/kadalu/binnacle/releases/latest/download/install.sh | sudo bash -x
binnacle --version
- name: Release builds
run: sudo VERSION="${{ github.ref_name }}" binnacle -vv ci/release_build.t
- name: Upload binary files to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/kadalu-volgen-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload Template files to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: templates/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
18 changes: 18 additions & 0 deletions ci/release_build.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- mode: ruby -*-

PKG_VERSION = ENV["VERSION"]
ENTRYPOINT = "/bin/sh"
CMD_ARGS = "-c '/sbin/apk add --update --no-cache --force-overwrite libxml2-static xz-static && /usr/bin/shards build --production --release --static --stats --time'"

# Build Amd64
TEST %{docker run --platform=linux/amd64 -i -v `pwd`:/workspace -w /workspace --env VERSION=#{PKG_VERSION} --rm --entrypoint #{ENTRYPOINT} 84codes/crystal:1.7.2-alpine-latest #{CMD_ARGS}}

# Rename release binary
TEST "mv bin/kadalu-volgen bin/kadalu-volgen-amd64"

# Build Arm64
TEST "docker run --rm --privileged multiarch/qemu-user-static --reset -p yes"
TEST %{docker run --platform=linux/arm64 -v `pwd`:/workspace -w /workspace --env VERSION=#{PKG_VERSION} -i --rm --entrypoint #{ENTRYPOINT} 84codes/crystal:1.7.2-alpine-latest #{CMD_ARGS}}

# Rename release binary
TEST "mv bin/kadalu-volgen bin/kadalu-volgen-arm64"

0 comments on commit 69f453f

Please sign in to comment.