diff --git a/.github/workflows/on-release-tag.yml b/.github/workflows/on-release-tag.yml new file mode 100644 index 0000000..362d709 --- /dev/null +++ b/.github/workflows/on-release-tag.yml @@ -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 diff --git a/ci/release_build.t b/ci/release_build.t new file mode 100644 index 0000000..e4511b5 --- /dev/null +++ b/ci/release_build.t @@ -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"