Create a new release #177
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: Create a new release | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseTag: | |
description: 'Release Tag' | |
required: true | |
productionRelease: | |
type: boolean | |
description: Mark release as production ready | |
jobs: | |
release-ubuntu: | |
name: Build for Linux | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
BUILD_TARGET: x86_64-unknown-linux-musl | |
BINARY_NAME: fastn | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build-musl | |
uses: gmiam/rust-musl-action@9e6a37bf27ecfffb6b92240ea276bea5487fa15d | |
continue-on-error: false | |
with: | |
args: cargo build --target $BUILD_TARGET --release | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: linux_musl_x86_64 | |
path: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }} | |
release-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions-rs/toolchain@v1 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run Build | |
id: build-windows | |
continue-on-error: false | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- uses: actions/upload-artifact@master | |
with: | |
name: windows_x64_latest | |
path: target/release/fastn.exe | |
- name: Download EnVar plugin for NSIS | |
uses: carlosperate/download-file-action@v1.0.3 | |
with: | |
file-url: https://github.com/GsNSIS/EnVar/releases/download/v0.3.1/EnVar-Plugin.zip | |
file-name: envar_plugin.zip | |
location: ${{ github.workspace }} | |
- name: Extract EnVar plugin | |
run: 7z x -o"${{ github.workspace }}/NSIS_Plugins" "${{ github.workspace }}/envar_plugin.zip" | |
- name: Create installer | |
uses: joncloud/makensis-action@v4 | |
with: | |
arguments: /V3 /DCURRENT_WD=${{ github.workspace }} /DVERSION=${{ github.event.inputs.releaseTag }} | |
additional-plugin-paths: ${{ github.workspace }}/NSIS_Plugins/Plugins | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: windows_x64_installer.exe | |
path: windows_x64_installer.exe | |
release-macos: | |
name: Build for MacOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions-rs/toolchain@v1 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run Build | |
id: build-macos | |
continue-on-error: false | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- uses: actions/upload-artifact@master | |
with: | |
name: macos_x64_latest | |
path: | | |
target/release/fastn | |
create-release: | |
name: Create github tag and release | |
runs-on: ubuntu-latest | |
needs: [release-ubuntu, release-macos, release-windows] | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/download-artifact@v2 | |
with: | |
name: macos_x64_latest | |
path: ~/download/macos | |
- uses: actions/download-artifact@v2 | |
with: | |
name: linux_musl_x86_64 | |
path: ~/download/linux_musl | |
- uses: actions/download-artifact@v2 | |
with: | |
name: windows_x64_latest | |
path: ~/download/windows | |
- uses: actions/download-artifact@v2 | |
with: | |
name: windows_x64_installer.exe | |
path: ~/download/windows | |
- name: Rename assets | |
run: | | |
mv ~/download/windows/fastn.exe ~/download/windows/fastn_windows_x86_64.exe | |
mv ~/download/windows/windows_x64_installer.exe ~/download/windows/fastn_setup.exe | |
mv ~/download/macos/fastn ~/download/macos/fastn_macos_x86_64 | |
mv ~/download/linux_musl/fastn ~/download/linux_musl/fastn_linux_musl_x86_64 | |
- name: Update .github/RELEASE_TEMPLATE.md | |
run: | | |
sed -i "s/GITHUB_SHA/${GITHUB_SHA}/g" .github/RELEASE_TEMPLATE.md | |
sed -i "s/DATE/$(date)/g" .github/RELEASE_TEMPLATE.md | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "~/download/windows/fastn_windows_x86_64.exe,~/download/windows/fastn_setup.exe,~/download/macos/fastn_macos_x86_64,~/download/linux_musl/fastn_linux_musl_x86_64" | |
generateReleaseNotes: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.event.inputs.releaseTag }} | |
prerelease: ${{ github.event.inputs.productionRelease && github.event.inputs.productionRelease == 'false' }} | |
bodyFile: .github/RELEASE_TEMPLATE.md |