[web] - update prod envs (#637) #54
Workflow file for this run
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: Prerelease | |
# IMPORTANT: This workflow utilizes caching for previous build artifacts. In the | |
# event of a full/partial rebuild, remember to manually remove corresponding | |
# cache records from the GitHub Actions admin panel. | |
# | |
# Benefit of this caching strategy is that it allows for individual cache | |
# invalidation for each binary | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+' | |
paths: | |
- '.github/workflows/prerelease.yaml' | |
- 'git-remote-gosh/**' | |
- 'v1_x/**' | |
- 'v2_x/**' | |
- 'v3_x/**' | |
- 'v4_x/**' | |
- 'v5_x/**' | |
- 'v6_x/**' | |
permissions: | |
contents: write | |
env: | |
release: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'gosh-sh/gosh' }} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
bin: | |
- git-remote-gosh | |
- git-remote-gosh_v1_0_0 | |
- git-remote-gosh_v2_0_0 | |
- git-remote-gosh_v3_0_0 | |
- git-remote-gosh_v4_0_0 | |
- git-remote-gosh_v5_0_0 | |
- git-remote-gosh_v5_1_0 | |
- git-remote-gosh_v6_0_0 | |
- git-remote-gosh_v6_1_0 | |
- git-remote-gosh_v6_2_0 | |
result: | |
- git-remote-gosh-darwin-arm64 | |
- git-remote-gosh-darwin-amd64 | |
- git-remote-gosh-linux-arm64 | |
- git-remote-gosh-linux-amd64 | |
include: | |
# targets | |
- result: git-remote-gosh-darwin-arm64 | |
target: aarch64-apple-darwin | |
os: macos-13 | |
- result: git-remote-gosh-darwin-amd64 | |
target: x86_64-apple-darwin | |
os: macos-13 | |
- result: git-remote-gosh-linux-arm64 | |
target: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
- result: git-remote-gosh-linux-amd64 | |
target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
# cargo projects | |
- bin: git-remote-gosh | |
dir: gosh-dispatcher | |
- bin: git-remote-gosh_v1_0_0 | |
dir: v1_x/git-remote-gosh | |
- bin: git-remote-gosh_v2_0_0 | |
dir: v2_x/git-remote-gosh | |
- bin: git-remote-gosh_v3_0_0 | |
dir: v3_x/git-remote-gosh | |
- bin: git-remote-gosh_v4_0_0 | |
dir: v4_x/git-remote-gosh | |
- bin: git-remote-gosh_v5_0_0 | |
dir: v5_x/v5.0.0/git-remote-gosh | |
- bin: git-remote-gosh_v5_1_0 | |
dir: v5_x/v5.1.0/git-remote-gosh | |
- bin: git-remote-gosh_v6_0_0 | |
dir: v6_x/v6.0.0/git-remote-gosh | |
- bin: git-remote-gosh_v6_1_0 | |
dir: v6_x/v6.1.0/git-remote-gosh | |
- bin: git-remote-gosh_v6_2_0 | |
dir: v6_x/v6.2.0/git-remote-gosh | |
name: B ${{ matrix.bin }} ${{ matrix.target }} | |
env: | |
CARGO_TERM_COLOR: always | |
SCCACHE_GHA_VERSION: ${{ vars.SCCACHE_GHA_VERSION || 1 }} # Setting this env var enables the caching | |
RUSTC_WRAPPER: sccache | |
CMAKE_C_COMPILER_LAUNCHER: sccache | |
CMAKE_CXX_COMPILER_LAUNCHER: sccache | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set VERSION | |
id: version | |
run: | | |
echo "VERSION=$(cat version.json | jq -r .version)" >> "$GITHUB_OUTPUT" | |
- name: Configure sccache | |
uses: mozilla-actions/[email protected] | |
- name: Setup cargo cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: builder-${{ runner.os }}-cargo | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install Linux tools | |
if: startsWith(matrix.os, 'ubuntu-') | |
env: | |
packages: >- | |
build-essential | |
cmake | |
curl | |
clang | |
librocksdb-dev | |
protobuf-compiler | |
python3-pip | |
run: | | |
sudo apt update -yq | |
sudo apt install -yq $packages | |
pip3 install ziglang | |
[[ -f ~/.cargo/bin/cargo-zigbuild ]] || cargo install cargo-zigbuild | |
- name: Install MacOS tools | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
brew install protobuf | |
- name: Build Binary ${{ matrix.dir }}/target/${{ matrix.target }}/release/${{ matrix.bin }} | |
working-directory: ${{ matrix.dir }} | |
env: | |
CARGO_INCREMENTAL: 0 # important for cache size too | |
CARGO_NET_RETRY: 10 | |
RUST_BACKTRACE: full | |
RUSTUP_MAX_RETRIES: 10 | |
run: | | |
cargo update | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
cargo build -r --target ${{ matrix.target }} | |
else | |
cargo zigbuild -r --target ${{ matrix.target }} | |
fi | |
ls -lA target/${{ matrix.target }}/release | |
- name: Artifact ${{ matrix.result }} | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ matrix.dir }}/target/${{ matrix.target }}/release/${{ matrix.bin }} | |
name: ${{ matrix.result }}--${{ matrix.bin }} | |
if-no-files-found: error | |
retention-days: 3 | |
outputs: | |
version: ${{ steps.version.outputs.VERSION }} | |
release: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
result: | |
- git-remote-gosh-darwin-arm64 | |
- git-remote-gosh-darwin-amd64 | |
- git-remote-gosh-linux-arm64 | |
- git-remote-gosh-linux-amd64 | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: Display structure of downloaded files | |
run: ls -R | |
## IMPORTANT! only works with non-windows binaries | |
- name: Gather all binaries "${{ matrix.result }}" | |
run: | | |
mkdir -p ${{ matrix.result }} | |
cp ${{ matrix.result }}--*/* ${{ matrix.result }} | |
ls -lA ${{ matrix.result }} | |
- name: Make archive | |
run: | | |
chmod +x ${{ matrix.result }}/* | |
cd ${{ matrix.result }} | |
printf "%s\n" git-remote-gosh_* | sort -rV | tee dispatcher.ini | |
tar -czvf ../${{ matrix.result }}.tar.gz . | |
- name: Upload Draft | |
uses: softprops/action-gh-release@v1 | |
if: env.release != 'true' | |
with: | |
draft: true | |
tag_name: ${{ github.ref_name }}-${{ github.run_number }} | |
files: | | |
${{ matrix.result }}.tar.gz | |
body: "" | |
- name: Upload Prerelease | |
uses: softprops/action-gh-release@v1 | |
if: env.release == 'true' | |
with: | |
prerelease: true | |
tag_name: ${{ github.ref_name }} | |
files: | | |
${{ matrix.result }}.tar.gz | |
name: "Version: ${{ github.ref_name }}" | |
body: "" |