Skip to content

build-release

build-release #39

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.platform }}
strategy:
fail-fast: true
matrix:
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: |
```json
${{ toJson(job) }}
```
### 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: Install rpm tools
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends rpm
- name: Install mingw toolchain
if: matrix.platform == 'windows'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends mingw-w64
- name: Rustup Self Update
if: matrix.platform != 'macos'
run: |
rustup self update
- name: Update Rust toolchain from channel ${{ matrix.channel }}
run: |
rustup update ${{ matrix.channel }}
rustup default ${{ matrix.channel }}
- name: Check Rust ${{ matrix.channel }} toolchain versions
run: |
rustup --version
cargo --version
rustc --version
rustup show
- name: Install cargo plugins
if: matrix.platform == 'linux'
run: cargo install cargo-deb cargo-generate-rpm
# endregion
# region Compiling
- name: Create local artifact folders
run: mkdir -p ${{ env.ARTIFACT_DIR }} target/assets
- name: Generate Assets
run: cargo run -- generate --all --output-dir target/assets
- name: Compiling the application for further packaging
run: cargo build --release
# endregion
# region Packaging
- name: Make a tar package for release (linux and macos)
if: matrix.platform == 'linux' || matrix.platform == 'macos'
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'
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'
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'
run: cargo generate-rpm --profile release --output ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.rpm
# endregion
# region Upload Artifact
- name: Upload Debian Package
uses: actions/upload-release-asset@v1
if: matrix.platform == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.deb
asset_name: ${{ env.ARTIFACT_NAME }}.deb
asset_content_type: application/vnd.debian.binary-package
- name: Upload RPM Package
uses: actions/upload-release-asset@v1
if: matrix.platform == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.rpm
asset_name: ${{ env.ARTIFACT_NAME }}.rpm
asset_content_type: application/x-rpm
- name: Upload linux binary package
uses: actions/upload-release-asset@v1
if: matrix.platform == 'linux' || matrix.platform == 'macos'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.tar.gz
asset_name: ${{ env.ARTIFACT_NAME }}.tar.gz
asset_content_type: application/octet-stream
- name: Upload windows binary package
uses: actions/upload-release-asset@v1
if: matrix.platform == 'windows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}.zip
asset_name: ${{ env.ARTIFACT_NAME }}.zip
asset_content_type: application/octet-stream
# endregion
# end of file