Avoid rate limiting #9
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: Build CLI binaries | |
on: | |
- push | |
permissions: | |
contents: write | |
jobs: | |
build-and-upload: | |
name: Build and upload | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
- build: macos-m1 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
- build: windows-gnu | |
os: windows-latest | |
target: x86_64-pc-windows-gnu | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
- name: Install protoc for lang repo | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build diffenator3/diff3proof | |
run: cargo build --verbose --release --target ${{ matrix.target }} | |
- name: Decide on our version name (tag or "dev") | |
id: version | |
run: | | |
if [ -n "$GITHUB_REF" ]; then | |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" | |
else | |
echo "VERSION=dev" | |
fi | |
else | |
echo "VERSION=dev" | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Build archive | |
shell: bash | |
run: | | |
dirname="diffenator3-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/"*.exe "$dirname" | |
7z a "$dirname.zip" "$dirname" | |
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | |
else | |
mv "target/${{ matrix.target }}/release/diffenator3" "$dirname" | |
mv "target/${{ matrix.target }}/release/diff3proof" "$dirname" | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
fi | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ASSET }} | |
path: ${{ env.ASSET }} | |
- if: contains(github.ref, 'refs/tags/') | |
name: Create a release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.ASSET }} | |
tag_name: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |