Skip to content

build-release

build-release #44

Workflow file for this run

## Workflow triggered when issuing a new release
name: build-release
on:
release:
types: [released]
workflow_dispatch:
inputs:
release_version_tag:
description: 'Run the workflow with what release tag?'
required: true
type: string
branch_commit_or_ref:
description: 'Run the release workflow in what branch/commit?'
required: true
type: string
default: master
jobs:
releasing:
name: releasing
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
platform: [ linux, windows, macos ]
include:
- platform: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
channel: stable
- platform: windows
os: windows-latest
target: x86_64-pc-windows-gnu
channel: stable
- platform: macos
os: macos-latest
target: x86_64-apple-darwin
channel: stable
env:
RELEASE_VERSION: ${{ inputs.release_version_tag || github.event.release.tag_name }}
TARGET_DIR: target/release
ARTIFACT_DIR: target/artifacts
ARTIFACT_NAME: solrcopy-${{ inputs.release_version_tag || github.event.release.tag_name }}-${{ matrix.target }}
steps:
# region Workflow information
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_commit_or_ref || '' }}
- name: Report Workflow Information
id: workflow_report
uses: ./.github/actions/workflow-info
with:
title: '${{ github.ref_name }}'
parameters: '${{ toJson(inputs) }}'
content: |
### Release information
- Tag Name: ${{ github.event.release.tag_name }}
- Commit SHA: ${{ github.sha }}
- Ref: ${{ github.head_ref }}
- Upload URL: ${{ github.event.release.upload_url }}
# endregion
# region Compiling
- name: Rustup Self Update
if: matrix.platform != 'macos'
shell: bash
run: |
rustup self update
- name: Update Rust toolchain from channel ${{ matrix.channel }}
shell: bash
run: |
rustup update ${{ matrix.channel }}
rustup default ${{ matrix.channel }}
- name: Check Rust ${{ matrix.channel }} toolchain versions
shell: bash
run: |
rustup --version
cargo --version
rustc --version
rustup show
- name: Install cargo plugins
if: matrix.platform == 'linux'
shell: bash
run: cargo install cargo-deb cargo-generate-rpm
# endregion
# region Compiling
- name: Create local artifact folders
shell: bash
run: |
mkdir -p ${{ env.ARTIFACT_DIR }}
mkdir -p target/assets
- name: Generate Assets
shell: bash
run: cargo run -- generate --all --output-dir target/assets
- name: Compiling the application for further packaging
shell: bash
run: cargo build --release
# endregion
# region Packaging
- name: Make a tar package for release (linux and macos)
if: matrix.platform == 'linux' || matrix.platform == 'macos'
shell: bash
run: tar --directory=${{ env.TARGET_DIR }} -czvf ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.tar.gz solrcopy
- name: Make a Windows zip package
if: matrix.platform == 'windows'
shell: bash
run: |
ls -lshFGHL ${{ env.TARGET_DIR }}
zip -j ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.zip ${{ env.TARGET_DIR }}/solrcopy.exe
- name: Make the debian package
if: matrix.platform == 'linux'
shell: bash
run: cargo deb --profile release --verbose --no-build --output ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.deb
- name: Make a rpm package
if: matrix.platform == 'linux'
shell: bash
run: cargo generate-rpm --profile release --output ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.rpm
# endregion
# region Upload Artifact
- name: Upload Debian, RPM and tar.gz Packages
if: matrix.platform == 'linux'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
shell: bash
run: |
gh release upload --clobber ${{ env.RELEASE_VERSION }} ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.rpm
gh release upload --clobber ${{ env.RELEASE_VERSION }} ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.deb
gh release upload --clobber ${{ env.RELEASE_VERSION }} ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.tar.gz
- name: Upload MacOS Tar package
if: matrix.platform == 'macos'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
shell: bash
run: |
gh release upload --clobber ${{ env.RELEASE_VERSION }} ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.tar.gz
- name: Upload Windows Zip package
if: matrix.platform == 'windows'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
gh release upload --clobber ${{ env.RELEASE_VERSION }} ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.zip
# endregion
# end of file