update #12
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
on: | |
push: | |
tags: | |
- v* | |
permissions: | |
contents: write | |
name: make-release | |
jobs: | |
makerelease: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
name: make release | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' | |
- name: Set up Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: zooapi | |
- name: Install latest nightly | |
uses: dtolnay/rust-toolchain@stable | |
- if: ${{ matrix.os == 'ubuntu-latest' }} | |
name: Install deps | |
shell: bash | |
run: | | |
./.github/workflows/cross-deps.sh | |
- if: ${{ matrix.os == 'macos-latest' }} | |
name: Install deps | |
shell: bash | |
run: | | |
brew install \ | |
coreutils \ | |
jq \ | |
openssl \ | |
pkg-config | |
cargo install toml-cli | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run make cross | |
run: | | |
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" | |
make release | |
ls -la cross | |
shell: bash | |
- name: move files to dir for upload | |
shell: bash | |
run: | | |
export VERSION=v$(toml get Cargo.toml package.version | jq -r .) | |
mkdir -p releases/$(basename $(pwd)) | |
cp -r cross releases/$(basename $(pwd))/${VERSION} | |
cp cross/README.md cross/${{matrix.os}}-${{github.ref_name}}-README.md | |
- name: 'upload binary files' | |
id: upload-files | |
uses: google-github-actions/[email protected] | |
with: | |
path: releases | |
destination: dl.zoo.io | |
# Store the binary artifacts for retrival later. | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-${{ matrix.os }}-${{github.ref_name}} | |
path: ./cross | |
# Store the readme as an artifact so we can combine the two. | |
- name: Archive the README.md data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{matrix.os}}-${{github.ref_name}}-README.md | |
path: ${{github.workspace}}/cross/${{matrix.os}}-${{github.ref_name}}-README.md | |
createrelease: | |
runs-on: ubuntu-latest | |
needs: [makerelease] | |
name: createrelease | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest nightly | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release-macos-latest-${{github.ref_name}} | |
path: build | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release-ubuntu-latest-${{github.ref_name}} | |
path: build | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ubuntu-latest-${{github.ref_name}}-README.md | |
- uses: actions/download-artifact@v4 | |
with: | |
name: macos-latest-${{github.ref_name}}-README.md | |
- name: combine readmes | |
shell: bash | |
run: | | |
ls -la | |
echo 'These instructions are meant as an easy way to install. Note: you likely need to install `coreutils` in order to have the `sha256sum` command.' > release.md | |
echo "" >> release.md | |
cat macos-latest-${{github.ref_name}}-README.md \ | |
ubuntu-latest-${{github.ref_name}}-README.md \ | |
>> release.md | |
rm build/*-README.md | |
rm build/README.md | |
- name: Get if prerelease | |
shell: bash | |
id: extract_prerelease | |
run: | | |
cargo install toml-cli | |
export VERSION=v$(toml get Cargo.toml package.version | jq -r .) | |
if echo $VERSION | grep -q "rc"; then | |
echo "##[set-output name=prerelease;]$(echo true)"; | |
else | |
if echo $VERSION | grep -q "pre"; then | |
echo "##[set-output name=prerelease;]$(echo true)"; | |
else | |
echo "##[set-output name=prerelease;]$(echo false)"; | |
fi | |
fi | |
- name: Create a Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: ${{github.workspace}}/release.md | |
prerelease: ${{steps.extract_prerelease.outputs.prerelease}} | |
files: ./build/* |