chore: Release #46
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
# CI that: | |
# | |
# * checks for a Git Tag that looks like a release ("v1.2.0") | |
# * creates a Github Release™️ | |
# * builds binaries/packages with cargo-dist | |
# * uploads those packages to the Github Release™️ | |
# | |
# Note that the Github Release™️ will be created before the packages, | |
# so there will be a few minutes where the release has no packages | |
# and then they will slowly trickle in, possibly failing. To make | |
# this more pleasant we mark the release as a "draft" until all | |
# artifacts have been successfully uploaded. This allows you to | |
# choose what to do with partial successes and avoids spamming | |
# anyone with notifications before the release is actually ready. | |
name: Release | |
permissions: | |
contents: write | |
# This task will run whenever you push a git tag that looks like | |
# a version number. We just look for `v` followed by at least one number | |
# and then whatever. so `v1`, `v1.0.0`, and `v1.0.0-prerelease` all work. | |
# | |
# If there's a prerelease-style suffix to the version then the Github Release™️ | |
# will be marked as a prerelease (handled by taiki-e/create-gh-release-action). | |
# | |
# Note that when generating links to uploaded artifacts, cargo-dist will currently | |
# assume that your git tag is always v{VERSION} where VERSION is the version in | |
# the published package's Cargo.toml (this is the default behaviour of cargo-release). | |
# In the future this may be made more robust/configurable. | |
on: | |
workflow_run: | |
workflows: [ "Build and Test with Coverage" ] | |
branches: [ main ] | |
types: | |
- completed | |
push: | |
tags: | |
- v[0-9]+.* | |
env: | |
ALL_CARGO_DIST_TARGET_ARGS: --target=x86_64-unknown-linux-gnu --target=x86_64-apple-darwin | |
ALL_CARGO_DIST_INSTALLER_ARGS: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
# Create the Github Release™️ so the packages have something to be uploaded to | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.create-gh-release.outputs.computed-prefix }}${{ steps.create-gh-release.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: create-gh-release | |
uses: taiki-e/create-gh-release-action@v1 | |
with: | |
draft: true | |
# (required) GitHub token for creating GitHub Releases. | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Build and packages all the things | |
upload-artifacts: | |
needs: create-release | |
strategy: | |
matrix: | |
# For these target platforms | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
runs-on: ${{ matrix.os }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
- name: InstallLinuxDependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get update && sudo apt-get -y install libzmq3-dev binaryen | |
- name: InstallMacDependencies | |
if: matrix.os == 'macos-latest' | |
run: brew install zmq binaryen | |
- name: AddWasmTarget | |
run: rustup +nightly target add wasm32-unknown-unknown | |
- name: InstallWasmTools | |
run: cargo install wasm-gc wasm-snip | |
- uses: actions/checkout@v3 | |
- name: Install cargo-dist | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-dist | |
- name: Run cargo-dist | |
run: | | |
# make zips and whatnot | |
cargo +nightly dist --target=${{ matrix.target }} --output-format=json > dist-manifest.json | |
cat dist-manifest.json | |
# Parse out what we just built and upload it to the Github Release™️ | |
cat dist-manifest.json | jq --raw-output ".releases[].artifacts[].path" > uploads.txt | |
cat uploads.txt | |
gh release upload ${{ needs.create-release.outputs.tag }} $(cat uploads.txt) | |
- name: build flowstdlib in wasm (on Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: target/${{ matrix.target }}/dist/flowc -d -g -O flowstdlib | |
- name: Upload flowstdlib tarball (on Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cd $HOME/.flow/lib | |
tar -cJf flowstdlib-${{ needs.create-release.outputs.tag }}.tar.xz flowstdlib | |
cd - | |
gh release upload ${{ needs.create-release.outputs.tag }} $HOME/.flow/lib/flowstdlib-${{ needs.create-release.outputs.tag }}.tar.xz | |
- name: build flowrcli | |
if: matrix.os == 'ubuntu-latest' | |
run: target/${{ matrix.target }}/dist/flowc flowr/src/bin/flowrcli | |
- name: Upload flowrcli | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cd $HOME/.flow/runner | |
tar -cJf flowrcli-${{ needs.create-release.outputs.tag }}.tar.xz flowrcli | |
cd - | |
gh release upload ${{ needs.create-release.outputs.tag }} $HOME/.flow/runner/flowrcli-${{ needs.create-release.outputs.tag }}.tar.xz | |
- name: build flowrgui | |
if: matrix.os == 'ubuntu-latest' | |
run: target/${{ matrix.target }}/dist/flowc flowr/src/bin/flowrgui | |
- name: Upload flowrgui | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cd $HOME/.flow/runner | |
tar -cJf flowrgui-${{ needs.create-release.outputs.tag }}.tar.xz flowrgui | |
cd - | |
gh release upload ${{ needs.create-release.outputs.tag }} $HOME/.flow/runner/flowrgui-${{ needs.create-release.outputs.tag }}.tar.xz | |
# Compute and upload the manifest for everything | |
upload-manifest: | |
needs: create-release | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup update nightly && rustup default nightly | |
- name: Install cargo-dist | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-dist | |
- name: Run cargo-dist manifest | |
run: | | |
# Generate a manifest describing everything | |
cargo +nightly dist init | |
cargo +nightly dist manifest --no-local-paths --output-format=json $ALL_CARGO_DIST_TARGET_ARGS $ALL_CARGO_DIST_INSTALLER_ARGS > dist-manifest.json | |
cat dist-manifest.json | |
echo "Tag is " ${{ needs.create-release.outputs.tag }} | |
gh release upload ${{ needs.create-release.outputs.tag }} dist-manifest.json | |
# Edit the Github Release™️ title/body to match what cargo-dist thinks it should be | |
CHANGELOG_TITLE=$(cat dist-manifest.json | jq --raw-output ".releases[].changelog_title") | |
echo "Changelog Title is " $CHANGELOG_TITLE | |
cat dist-manifest.json | jq --raw-output ".releases[].changelog_body" > new_dist_changelog.md | |
gh release edit ${{ needs.create-release.outputs.tag }} --notes-file=new_dist_changelog.md | |
echo "updated release notes!" | |
# Mark the Github Release™️ as a non-draft now that everything has succeeded! | |
publish-release: | |
needs: [create-release, upload-artifacts, upload-manifest] | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: mark release as non-draft | |
run: | | |
gh release edit ${{ needs.create-release.outputs.tag }} --title ${{ needs.create-release.outputs.tag }} --draft=false | |
build-and-publish-book: | |
needs: [publish-release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: build-book | |
run: | | |
sudo apt-get update && sudo apt-get -y install graphviz | |
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.27/mdbook-v0.4.27-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=$HOME/.cargo/bin | |
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip > mdbook-linkcheck.zip | |
mkdir -p $HOME/.cargo/bin | |
unzip mdbook-linkcheck.zip -d $HOME/.cargo/bin | |
chmod +x $HOME/.cargo/bin/mdbook-linkcheck | |
echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV" | |
make book | |
- name: Deploy book | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: target/html |