Prepare release workflow (#40)
This commit is contained in:
parent
847367f51e
commit
ea59a72cd0
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -3,7 +3,8 @@ name: lint, format, test, build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
# ignore for now
|
||||||
|
# pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
|||||||
104
.github/workflows/release.yml
vendored
Normal file
104
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "release/**"
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
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 # `x86_64` by default
|
||||||
|
- 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
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
|
- name: Build (windows)
|
||||||
|
if: matrix.os_target == 'windows'
|
||||||
|
run: nix build .#windows
|
||||||
|
|
||||||
|
- name: Build (linux/macos)
|
||||||
|
if: matrix.os_target != 'windows'
|
||||||
|
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/**/*
|
||||||
Loading…
x
Reference in New Issue
Block a user