Merge branch 'main' into readme-update #7
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
# as well as releasing binaries of the roles | ||
# (translator, pool, mining_proxy) to github. | ||
# If the binary releases do fail to due to not having tags, force run the `autoversion` workflow | ||
# on the main branch and merge the resulting PR to create the tags and move them to the main branch. | ||
name: Release Binaries | ||
on: | ||
# Manually run by going to "Actions/Release" in Github and running the workflow | ||
workflow_dispatch: | ||
jobs: | ||
github_release_translator: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
artifact_name: translator_sv2 | ||
asset_name: translator_sv2-linux-amd64 | ||
# - os: windows-latest | ||
# artifact_name: translator_sv2.exe | ||
# asset_name: translator_sv2-windows-amd64 | ||
- os: macos-latest | ||
artifact_name: translator_sv2 | ||
asset_name: translator_sv2-macos-amd64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# The tags are not in scope until we fetch them from main | ||
# This will fail if there are no tags available | ||
- name: fetch tags | ||
run: git fetch origin --tags | ||
# Find the latest translator tag by listing folders in `.git/refs/tags` with pattern `translator_sv2`, | ||
# taking the last one, and setting to `TRANSLATOR_TAG` env variable. This will be used as the "tag" in the | ||
# Build step | ||
- name: set env unix | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo "TRANSLATOR_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'translator_sv2' | tail -n 1))" >> $GITHUB_ENV | ||
# This does not work | ||
- name: set env windows | ||
if: matrix.os == 'windows-latest' | ||
run: echo "$(dir .git/refs/tags | findstr "translator_sv2")" | ||
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead) | ||
# `dir` will fail on mac builds | ||
- name: check refs | ||
run: ls .git/refs/tags | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo ${{ env.TRANSLATOR_TAG }} | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'windows-latest' | ||
run: echo "${{ env.TRANSLATOR_TAG }}" | ||
# Action to release build by given tag | ||
- name: Build | ||
run: cargo build --release --locked --package translator_sv2 | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/release/${{ matrix.artifact_name }} | ||
asset_name: ${{ matrix.asset_name }} | ||
tag: ${{ env.TRANSLATOR_TAG }} | ||
github_release_pool: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# This defines what environments we will build on | ||
include: | ||
- os: ubuntu-latest | ||
artifact_name: pool_sv2 | ||
asset_name: pool_sv2-linux-amd64 | ||
# - os: windows-latest | ||
# artifact_name: pool_sv2.exe | ||
# asset_name: pool_sv2-windows-amd64 | ||
- os: macos-latest | ||
artifact_name: pool_sv2 | ||
asset_name: pool_sv2-macos-amd64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# The tags are not in scope until we fetch them from main | ||
# This will fail if there are no tags available | ||
- name: fetch tags | ||
run: git fetch origin --tags | ||
# Find the latest pool tag by listing folders in `.git/refs/tags` with pattern `pool_sv2`, | ||
# taking the last one, and setting to `POOL_TAG` env variable. This will be used as the "tag" in the | ||
# Build step | ||
- name: set env unix | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo "POOL_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'pool_sv2' | tail -n 1))" >> $GITHUB_ENV | ||
# This does not work | ||
- name: set env windows | ||
if: matrix.os == 'windows-latest' | ||
run: echo "$(dir .git/refs/tags | findstr "pool_sv2")" | ||
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead) | ||
# `dir` will fail on mac builds | ||
- name: check refs | ||
run: ls .git/refs/tags | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo ${{ env.POOL_TAG }} | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'windows-latest' | ||
run: echo "${{ env.POOL_TAG }}" | ||
# Action to release build by given tag | ||
- name: Build | ||
run: cargo build --release --locked --package pool_sv2 | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/release/${{ matrix.artifact_name }} | ||
asset_name: ${{ matrix.asset_name }} | ||
tag: ${{ env.POOL_TAG }} | ||
github_release_mining_proxy: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# This defines what environments we will build on | ||
include: | ||
- os: ubuntu-latest | ||
artifact_name: mining_proxy_sv2 | ||
asset_name: mining_proxy_sv2-linux-amd64 | ||
# - os: windows-latest | ||
# artifact_name: mining_proxy_sv2.exe | ||
# asset_name: mining_proxy_sv2-windows-amd64 | ||
- os: macos-latest | ||
artifact_name: mining_proxy_sv2 | ||
asset_name: mining_proxy_sv2-macos-amd64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# The tags are not in scope until we fetch them from main | ||
# This will fail if there are no tags available | ||
- name: fetch tags | ||
run: git fetch origin --tags | ||
# Find the latest mining proxy tag by listing folders in `.git/refs/tags` with pattern `mining_proxy_sv2`, | ||
# taking the last one, and setting to `MINING_PROXY_TAG` env variable. This will be used as the "tag" in the | ||
# Build step | ||
- name: set env unix | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo "MINING_PROXY_TAG=$(echo refs/tags/$(ls .git/refs/tags | grep 'mining_proxy_sv2' | tail -n 1))" >> $GITHUB_ENV | ||
# This does not work | ||
- name: set env windows | ||
if: matrix.os == 'windows-latest' | ||
run: echo "$(dir .git/refs/tags | findstr "mining_proxy_sv2")" | ||
# This will fail on a Windows build. Must use if statement to check if running on Windows and use `dir` instead) | ||
# `dir` will fail on mac builds | ||
- name: check refs | ||
run: ls .git/refs/tags | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: echo ${{ env.MINING_PROXY_TAG }} | ||
# Debugging step to ensure tag is correct | ||
- name: check env | ||
if: matrix.os == 'windows-latest' | ||
run: echo "${{ env.MINING_PROXY_TAG }}" | ||
# Action to release build by given tag | ||
- name: Build | ||
run: cargo build --release --locked --package mining_proxy_sv2 | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/release/${{ matrix.artifact_name }} | ||
asset_name: ${{ matrix.asset_name }} | ||
tag: ${{ env.MINING_PROXY_TAG }} | ||