Prepare Release #72
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
name: Prepare Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_id: | |
description: 'Release id (tag name)' | |
required: true | |
env: | |
GO_VERSION: '1.22' | |
jobs: | |
create_release: | |
name: Create release draft | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 # https://github.com/actions/create-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided | |
with: | |
tag_name: ${{ github.event.inputs.release_id }} | |
body: | | |
Download the klog binary here: | |
- [**MacOS** Intel](https://github.com/jotaen/klog/releases/download/${{ github.event.inputs.release_id }}/klog-mac-intel.zip) | |
- [**MacOS** M1 (ARM)](https://github.com/jotaen/klog/releases/download/${{ github.event.inputs.release_id }}/klog-mac-arm.zip) | |
- [**Linux**](https://github.com/jotaen/klog/releases/download/${{ github.event.inputs.release_id }}/klog-linux.zip) | |
- [**Windows**](https://github.com/jotaen/klog/releases/download/${{ github.event.inputs.release_id }}/klog-windows.zip) | |
Consult the [changelog](https://github.com/jotaen/klog/blob/main/CHANGELOG.md) to learn what’s new. | |
See the [documentation website](https://klog.jotaen.net#get-klog) for install instructions, or to explore other install options. | |
In order to not miss any updates you can either subscribe to the release notifications on Github (at the top right: “Watch”→“Custom”→“Releases”), or check occasionally by running `klog version`. | |
release_name: ${{ github.event.inputs.release_id }} | |
prerelease: true | |
draft: true | |
build: | |
name: Build | |
needs: create_release | |
strategy: | |
matrix: | |
include: | |
- name: linux | |
go_os: linux | |
go_arch: amd64 | |
binary_name: klog | |
- name: mac-intel | |
go_os: darwin | |
go_arch: amd64 | |
binary_name: klog | |
- name: mac-arm | |
go_os: darwin | |
go_arch: arm64 | |
binary_name: klog | |
- name: windows | |
go_os: windows | |
go_arch: amd64 | |
binary_name: klog.exe | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build binary | |
env: | |
GOOS: ${{ matrix.go_os }} | |
GOARCH: ${{ matrix.go_arch }} | |
run: | | |
source ./run.sh | |
run::build ${{ github.event.inputs.release_id }} ${{ github.sha }} | |
- name: Smoke test | |
if: ${{ matrix.name == 'linux' }} | |
env: | |
EXPECTED_VERSION: ${{ github.event.inputs.release_id }} | |
EXPECTED_BUILD_HASH: ${{ github.sha }} | |
EXPECTED_SPEC_PATH: Specification.md | |
EXPECTED_LICENSE_PATH: LICENSE.txt | |
run: | | |
sudo cp out/klog /usr/bin/klog | |
./.github/smoke-test.sh | |
- name: Bundle | |
run: | | |
if [[ "${{ matrix.binary_name }}" != "klog" ]]; then | |
mv ./out/klog ./out/${{ matrix.binary_name }} | |
fi | |
cp ./.github/install_${{ matrix.go_os }}.md ./INSTALL.md | |
zip -j klog-${{ matrix.name }}.zip ./out/${{ matrix.binary_name }} ./INSTALL.md ./LICENSE.txt | |
- name: Upload binaries | |
uses: actions/upload-release-asset@v1 # https://github.com/actions/upload-release-asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./klog-${{ matrix.name }}.zip | |
asset_name: klog-${{ matrix.name }}.zip | |
asset_content_type: application/zip |