Skip to content

Update installer

Update installer #46

Workflow file for this run

name: Create a release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]-rc[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
name: Build the binaries
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- os: dragonfly
arch: amd64
- os: freebsd
arch: 386
- os: freebsd
arch: amd64
- os: freebsd
arch: arm
- os: freebsd
arch: arm64
- os: linux
arch: 386
- os: linux
arch: amd64
- os: linux
arch: arm
- os: linux
arch: arm64
- os: linux
arch: mips
- os: linux
arch: mips64
- os: linux
arch: mips64le
- os: linux
arch: mipsle
- os: linux
arch: ppc64
- os: linux
arch: ppc64le
- os: linux
arch: riscv64
- os: linux
arch: s390x
- os: netbsd
arch: 386
- os: netbsd
arch: amd64
- os: netbsd
arch: arm
- os: netbsd
arch: arm64
- os: openbsd
arch: 386
- os: openbsd
arch: amd64
- os: openbsd
arch: arm
- os: openbsd
arch: arm64
- os: solaris
arch: amd64
- os: windows
arch: 386
- os: windows
arch: amd64
- os: windows
arch: arm
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo "version=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Get go version
run: echo "go_version=$(go version)" >> $GITHUB_ENV
- name: Set binary name
if: matrix.platform.os != 'windows'
run: echo "binary_name=kpkg" >> $GITHUB_ENV
- name: Set binary name for windows
if: matrix.platform.os == 'windows'
run: echo "binary_name=kpkg.exe" >> $GITHUB_ENV
- name: Build
run: GOOS=${{ matrix.platform.os }} GOARCH=${{ matrix.platform.arch }} go build -o ${{ env.binary_name }} -ldflags="-X 'main.version=${{ env.version }}' -X 'main.commit=${{ github.sha }}' -X 'main.goVersion=${{ env.go_version }}' -X 'main.cliOs=${{ matrix.platform.os }}' -X 'main.cliArch=${{ matrix.platform.arch }}'"
- name: change binary permissions
run: chmod +x ./${{ env.binary_name }}
- name: zip binary
run: zip -r kpkg_${{ matrix.platform.os }}_${{ matrix.platform.arch }}.zip ./${{ env.binary_name }}
- name: upload zipped artifacts
uses: actions/upload-artifact@v2
with:
name: kpkg_${{ matrix.platform.os }}_${{ matrix.platform.arch }}.zip
path: kpkg_${{ matrix.platform.os }}_${{ matrix.platform.arch }}.zip
build-darwin:
runs-on: macos-latest
strategy:
matrix:
platform:
- arch: amd64
- arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo "version=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Get go version
run: echo "go_version=$(go version)" >> $GITHUB_ENV
- name: Build
run: GOOS=darwin GOARCH=${{ matrix.platform.arch }} go build -o kpkg -ldflags="-X 'main.version=${{ env.version }}' -X 'main.commit=${{ github.sha }}' -X 'main.goVersion=${{ env.go_version }}' -X 'main.cliOs=darwin' -X 'main.cliArch=${{ matrix.platform.arch }}'"
- name: change binary permissions
run: chmod +x ./kpkg
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Install gon via HomeBrew for code signing and app notarization
run: |
brew tap mitchellh/gon
brew install mitchellh/gon/gon
- name: Sign the mac binaries with Gon
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
run: gon ./gon.hcl
- name: Rename zip file
run: mv ./kpkg_darwin.zip ./kpkg_darwin_${{ matrix.platform.arch }}.zip
- name: upload notorized artifacts
uses: actions/upload-artifact@v2
with:
name: kpkg_darwin_${{ matrix.platform.arch }}.zip
path: kpkg_darwin_${{ matrix.platform.arch }}.zip
create-release:
needs: [build, build-darwin]
runs-on: ubuntu-latest
outputs:
release-url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Check if prerelease
run: |
if [[ ${{ github.ref }} == *"rc"* ]]; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ env.prerelease }}
upload-artifacts:
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- os: darwin
arch: amd64
- os: darwin
arch: arm64
- os: dragonfly
arch: amd64
- os: freebsd
arch: 386
- os: freebsd
arch: amd64
- os: freebsd
arch: arm
- os: freebsd
arch: arm64
- os: linux
arch: 386
- os: linux
arch: amd64
- os: linux
arch: arm
- os: linux
arch: arm64
- os: linux
arch: mips
- os: linux
arch: mips64
- os: linux
arch: mips64le
- os: linux
arch: mipsle
- os: linux
arch: ppc64
- os: linux
arch: ppc64le
- os: linux
arch: riscv64
- os: linux
arch: s390x
- os: netbsd
arch: 386
- os: netbsd
arch: amd64
- os: netbsd
arch: arm
- os: netbsd
arch: arm64
- os: openbsd
arch: 386
- os: openbsd
arch: amd64
- os: openbsd
arch: arm
- os: openbsd
arch: arm64
- os: solaris
arch: amd64
- os: windows
arch: 386
- os: windows
arch: amd64
- os: windows
arch: arm
steps:
- name: Set asset name
run: echo "artifact_name=kpkg_${{ matrix.platform.os }}_${{ matrix.platform.arch }}.zip" >> $GITHUB_ENV
- name: download asset
uses: actions/download-artifact@v2
with:
name: ${{ env.artifact_name }}
- name: upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release-url }}
asset_path: ${{ env.artifact_name }}
asset_name: ${{ env.artifact_name }}
asset_content_type: application/zip