chore: switch marvinpinto/action-automatic-releases for development b… #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
jobs: | |
build-release: | |
needs: create-release | |
name: build-release | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: 1 | |
strategy: | |
matrix: | |
build: | |
- linux gnu x64 | |
# - linux musl x64 | |
- linux gnu aarch64 | |
- linux gnu armv | |
- linux gnu armv7 | |
- linux gnu mips | |
- linux gnu mips64 | |
- linux gnu mips64el | |
- linux gnu mipsel | |
# - linux musl aarch64 | |
- macos x64 | |
- macos aarch64 | |
include: | |
- build: linux gnu x64 | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
# - build: linux musl x64 | |
# os: ubuntu-latest | |
# rust: stable | |
# target: x86_64-unknown-linux-musl | |
- build: linux gnu aarch64 | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
- build: linux gnu armv | |
os: ubuntu-latest | |
rust: stable | |
target: armv-unknown-linux-gnu | |
- build: linux gnu armv7 | |
os: ubuntu-latest | |
rust: stable | |
target: armv7-unknown-linux-gnu | |
- build: linux gnu mips | |
os: ubuntu-latest | |
rust: stable | |
target: mips-unknown-linux-gnu | |
- build: linux gnu mips64 | |
os: ubuntu-latest | |
rust: stable | |
target: mips64-unknown-linux-gnuabi64 | |
- build: linux gnu mips64el | |
os: ubuntu-latest | |
rust: stable | |
target: mips64el-unknown-linux-gnuabi64 | |
- build: linux gnu mipsel | |
os: ubuntu-latest | |
rust: stable | |
target: mipsel-unknown-linux-gnu | |
# - build: linux musl aarch64 | |
# os: ubuntu-latest | |
# rust: stable | |
# target: aarch64-unknown-linux-musl | |
- build: macos x64 | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
- build: macos aarch64 | |
os: macos-latest | |
rust: stable | |
target: aarch64-apple-darwin | |
steps: | |
- name: Set release tag | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]; then | |
echo "RELEASE_TAG=main" >> "$GITHUB_ENV" | |
else | |
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install dev-tools | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y --no-install-recommends pkg-config musl-dev musl-tools | |
- name: Install deps (ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y --no-install-recommends libssl-dev libsoxr-dev libopus-dev | |
- name: Install deps (macos) | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew update | |
brew install libsoxr | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --verbose --release --package media-server --target ${{ matrix.target }} | |
- name: Show files | |
run: | | |
ls -la ./target/${{ matrix.target }}/release | |
- name: Create checksum | |
id: make-checksum | |
working-directory: ./target/${{ matrix.target }}/release | |
run: | | |
name="media-server-${{ matrix.target }}.sha256sum" | |
if [[ "$RUNNER_OS" != "macOS" ]]; then | |
sha256sum "media-server" > "${name}" | |
else | |
shasum -a 256 "media-server" > "${name}" | |
fi | |
echo "::set-output name=name::${name}" | |
- name: Tar release | |
id: make-artifact | |
working-directory: ./target/${{ matrix.target }}/release | |
run: | | |
name="media-server-${{ matrix.target }}.tar.gz" | |
tar cvzf "${name}" "media-server" | |
echo "::set-output name=name::${name}" | |
- name: Upload release archive | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-artifact.outputs.name }} | |
asset_name: media-server-${{matrix.target}}.tar.gz | |
asset_content_type: application/octet-stream | |
- name: Upload checksum | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-checksum.outputs.name }} | |
asset_name: media-server-${{matrix.target}}.sha256sum | |
asset_content_type: text/plain | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: create_release | |
id: create_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ github.event_name == 'workflow_dispatch' && 'latest' || (github.ref == 'refs/heads/master' && 'latest') || github.ref }} | |
title: Build ${{ github.event_name == 'workflow_dispatch' && 'development' || github.ref }} | |
prerelease: true |