mirror of
https://github.com/arabianq/lyrics_fetcher.git
synced 2026-04-27 22:11:22 +00:00
add github workflow for dev release
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
name: Development Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build for ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
artifact_name: lyrics_fetcher-linux-amd64
|
||||
binary_name: lyrics_fetcher
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-gnu
|
||||
artifact_name: lyrics_fetcher-linux-arm64
|
||||
binary_name: lyrics_fetcher
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
artifact_name: lyrics_fetcher-windows-amd64.exe
|
||||
binary_name: lyrics_fetcher.exe
|
||||
- os: windows-latest
|
||||
target: aarch64-pc-windows-msvc
|
||||
artifact_name: lyrics_fetcher-windows-arm64.exe
|
||||
binary_name: lyrics_fetcher.exe
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
artifact_name: lyrics_fetcher-macos-amd64
|
||||
binary_name: lyrics_fetcher
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
artifact_name: lyrics_fetcher-macos-aarch64
|
||||
binary_name: lyrics_fetcher
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: ${{ matrix.target }}
|
||||
|
||||
- name: Install cross-compiler for Linux ARM64
|
||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
|
||||
|
||||
- name: Build binary
|
||||
run: cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Rename artifact
|
||||
shell: bash
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/${{ matrix.binary_name }} target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
||||
retention-days: 1
|
||||
|
||||
release:
|
||||
name: Update Development Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate release info
|
||||
id: release_info
|
||||
run: |
|
||||
echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
|
||||
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Publish Development Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: development
|
||||
target_commitish: ${{ github.sha }}
|
||||
name: "Development Build"
|
||||
body: |
|
||||
Автоматическая сборка последней версии для тестирования.
|
||||
|
||||
**Commit:** [${{ steps.release_info.outputs.commit }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
|
||||
**Date:** ${{ steps.release_info.outputs.date }}
|
||||
prerelease: true
|
||||
files: artifacts/*
|
||||
Reference in New Issue
Block a user