Skip to content

stable v1.1.0 - new features: HTTP call + YAML presets & defaults #12

stable v1.1.0 - new features: HTTP call + YAML presets & defaults

stable v1.1.0 - new features: HTTP call + YAML presets & defaults #12

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
runner: macos-latest
asset_name: dstimer-macos-x86_64
- target: aarch64-apple-darwin
runner: macos-latest
asset_name: dstimer-macos-aarch64
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
asset_name: dstimer-linux-x86_64
use_upx: true
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
asset_name: dstimer-linux-aarch64
use_cross: true
use_upx: true
- target: x86_64-pc-windows-msvc
runner: windows-latest
asset_name: dstimer.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install ALSA dev libraries (Linux x86_64)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
- name: Install cross (Linux aarch64)
if: matrix.use_cross == true
uses: taiki-e/install-action@cross
- name: Build (cross)
if: matrix.use_cross == true
run: cross build --release --target ${{ matrix.target }}
- name: Build (cargo)
if: matrix.use_cross != true
run: cargo build --release --target ${{ matrix.target }}
- name: Compress binary with UPX (Linux)
if: matrix.use_upx == true && matrix.runner == 'ubuntu-latest'
run: |
sudo apt-get install -y upx-ucl
upx --best --lzma target/${{ matrix.target }}/release/dstimer
- name: Compress binary with UPX (Windows)
if: matrix.use_upx == true && matrix.runner == 'windows-latest'
run: |
choco install upx -y
upx --best --lzma target/${{ matrix.target }}/release/dstimer.exe
- name: Rename binary (Unix)
if: matrix.runner != 'windows-latest'
run: cp target/${{ matrix.target }}/release/dstimer ${{ matrix.asset_name }}
- name: Rename binary (Windows)
if: matrix.runner == 'windows-latest'
run: cp target/${{ matrix.target }}/release/dstimer.exe ${{ matrix.asset_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
# publish-winget:
# name: Publish to WinGet
# needs: release
# runs-on: windows-latest
# steps:
# - name: Submit to WinGet
# uses: vedantmgoyal9/winget-releaser@v2
# with:
# identifier: madLinux.dstimer
# installers-regex: 'dstimer\.exe$'
# token: ${{ secrets.WINGET_TOKEN }}
update-scoop:
name: Update Scoop bucket
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout scoop-bucket repo
uses: actions/checkout@v4
with:
repository: madLinux7/scoop-bucket
token: ${{ secrets.SCOOP_TOKEN }}
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: dstimer.exe
path: artifacts
- name: Update Scoop manifest
run: |
VERSION="${GITHUB_REF_NAME#v}"
SHA256=$(sha256sum artifacts/dstimer.exe | cut -d' ' -f1)
jq --arg v "$VERSION" --arg h "$SHA256" \
'.version = $v |
.architecture."64bit".url = "https://github.com/madLinux7/dstimer/releases/download/v\($v)/dstimer.exe" |
.architecture."64bit".hash = $h' \
bucket/dstimer.json > bucket/dstimer.json.tmp && mv bucket/dstimer.json.tmp bucket/dstimer.json
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bucket/dstimer.json
git diff --cached --quiet || git commit -m "Update dstimer to ${GITHUB_REF_NAME}"
git push