* bump v1.3.1 * update CHANGELOG * start workflow by `release/*` branches only but not by tags to avoid overriding releases.
106 lines
3.1 KiB
YAML
106 lines
3.1 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "release/**"
|
|
|
|
jobs:
|
|
get-version:
|
|
name: Get version
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Get version from Cargo.toml
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f2)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
name: Build ${{ matrix.os_target }} on ${{ matrix.os }}
|
|
needs: get-version
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
os_target: linux
|
|
binary_name: timr-tui
|
|
arch: x86_64 # based on target 'x86_64-unknown-linux-musl' defined by `CARGO_BUILD_TARGET` in flake.nix
|
|
- os: ubuntu-latest
|
|
os_target: windows
|
|
binary_name: timr-tui.exe
|
|
arch: x86_64 # based on target 'x86_64-pc-windows-gnu' defined by `CARGO_BUILD_TARGET` in flake.nix
|
|
- os: macOS-latest
|
|
os_target: macos
|
|
binary_name: timr-tui
|
|
arch: x86_64 # `x86_64` by default
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
- name: Build (windows)
|
|
if: matrix.os_target == 'windows'
|
|
run: nix build .#windows
|
|
|
|
- name: Build (linux)
|
|
if: matrix.os_target == 'linux'
|
|
run: nix build .#linuxStatic
|
|
|
|
- name: Build (macos)
|
|
if: matrix.os_target == 'macos'
|
|
run: nix build
|
|
|
|
- name: Copy artifact
|
|
run: |
|
|
mkdir artifacts
|
|
cp result/bin/${{ matrix.binary_name }} artifacts/
|
|
|
|
- name: Install zip
|
|
if: matrix.os_target == 'windows'
|
|
run: sudo apt-get install -y zip
|
|
|
|
- name: Archive (windows)
|
|
if: matrix.os_target == 'windows'
|
|
run: |
|
|
cd artifacts
|
|
zip ${{ matrix.binary_name }}-${{ needs.get-version.outputs.version }}-${{ matrix.os_target }}_${{ matrix.arch }}.zip ${{ matrix.binary_name }}
|
|
|
|
- name: Archive (linux/macos)
|
|
if: matrix.os_target != 'windows'
|
|
run: |
|
|
cd artifacts
|
|
tar -czf ${{ matrix.binary_name }}-${{ needs.get-version.outputs.version }}-${{ matrix.os_target }}_${{ matrix.arch }}.tar.gz ${{ matrix.binary_name }}
|
|
|
|
- name: Upload archive
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.os_target }}-build
|
|
path: |
|
|
artifacts/*.tar.gz
|
|
artifacts/*.zip
|
|
overwrite: true
|
|
|
|
create-release:
|
|
name: Create draft release
|
|
needs: [get-version, build]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: true
|
|
|
|
- name: Create draft release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
draft: true
|
|
tag_name: "v${{ needs.get-version.outputs.version }}"
|
|
name: "v${{ needs.get-version.outputs.version }}"
|
|
body: Draft release generated by CI.
|
|
files: artifacts/**/*
|