Create a new release #263
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 | |
# using the oldest available ubuntu on github CI to provide maximum compatibility with glibc versions | |
# update RELEASTE_TEMPLATE with the glibc version | |
# on ubuntu-20.04, glibc version is 2.31 | |
runs-on: ubuntu-20.04 | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: print rustc version | |
run: rustc --version | |
- name: cargo build (linux) | |
run: cargo build --release | |
- name: print fastn version | |
run: ./target/release/fastn --version | |
- name: print file info | |
run: | | |
file ./target/release/fastn | |
ldd ./target/release/fastn | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux_x86_64 | |
path: target/release/fastn | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: print rustc version | |
run: rustc --version | |
- name: cargo build (windows) | |
run: cargo build --release | |
- name: print fastn version | |
run: target\release\fastn.exe --version | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows_x64_latest | |
path: target/release/fastn.exe | |
release-windows: | |
runs-on: ubuntu-latest | |
needs: [ build-windows ] | |
name: Make installer for windows build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: windows_x64_latest | |
path: result/bin/ | |
- name: check exe | |
run: | | |
ls -la result/bin/ | |
- name: Install NSIS & Plugins | |
run: | | |
sudo apt update && sudo apt install -y nsis nsis-pluginapi | |
sudo chown -R $(whoami) /usr/share/nsis/Plugins/ | |
wget https://github.com/GsNSIS/EnVar/releases/download/v0.3.1/EnVar-Plugin.zip | |
unzip EnVar-Plugin.zip -d EnVar-Plugin | |
sudo mv EnVar-Plugin/Plugins/amd64-unicode/* /usr/share/nsis/Plugins/amd64-unicode/ | |
sudo mv EnVar-Plugin/Plugins/x86-ansi/* /usr/share/nsis/Plugins/x86-ansi/ | |
sudo mv EnVar-Plugin/Plugins/x86-unicode/* /usr/share/nsis/Plugins/x86-unicode/ | |
- name: Create Installer | |
run: makensis -V3 -DCURRENT_WD=${{ github.workspace }} -DVERSION=${{ github.event.inputs.releaseTag }} install.nsi | |
- uses: actions/upload-artifact@v4 | |
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@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
ftd/target | |
fifthtry_content/target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: print rustc version | |
run: rustc --version | |
- name: Run Build | |
id: build-macos | |
continue-on-error: false | |
run: cargo build --release | |
- name: print fastn version | |
run: ./target/release/fastn --version | |
- name: print file info | |
run: | | |
file ./target/release/fastn | |
otool -L ./target/release/fastn | |
- uses: actions/upload-artifact@v4 | |
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@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: macos_x64_latest | |
path: ~/download/macos | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux_x86_64 | |
path: ~/download/linux | |
- uses: actions/download-artifact@v4 | |
with: | |
name: windows_x64_latest | |
path: ~/download/windows | |
- uses: actions/download-artifact@v4 | |
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/fastn ~/download/linux/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/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 |