Add GitHub release configuration

This commit is contained in:
Gabriel Simmer 2023-04-25 09:44:23 +01:00
parent 8a95ad430c
commit 3c408a7a0c
Signed by: arch
GPG key ID: C81B106D46C5B875

86
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,86 @@
name: Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: osc-triggers-linux
- os: windows-latest
target: x86_64-pc-windows-gnu
artifact_name: osc-triggers-windows
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libx11-dev libxtst-dev libudev-dev libinput-dev
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
RUSTFLAGS: -C target-feature=+crt-static
- name: Package
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a ${{ matrix.artifact_name }}.zip target/${{ matrix.target }}/release/osc-triggers.exe
else
tar czf ${{ matrix.artifact_name }}.tar.gz -C target/${{ matrix.target }}/release osc-triggers
fi
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Get current version
id: version
run: echo ::set-output name=version::$(date +'%Y.%m.%d-%H.%M')
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: osc-triggers-linux
path: artifacts/
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: osc-triggers-windows
path: artifacts/
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Release v${{ steps.version.outputs.version }}
files: |
artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}