Skip to content

Commit

Permalink
feat!: Hazel
Browse files Browse the repository at this point in the history
  • Loading branch information
cdata committed Dec 19, 2022
1 parent 6d7b187 commit 97599b9
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main

name: 'Perform a release (Rust)'
name: 'Perform a release'

jobs:
# NOTE: This step is stateful. When there are unreleased changes on main, it
Expand All @@ -23,7 +23,9 @@ jobs:
noosphere_cli_release_tag_name: ${{ steps.release.outputs['rust/noosphere-cli--tag_name'] }}
noosphere_released: ${{ steps.release.outputs['rust/noosphere--release_created'] }}
noosphere_release_tag_name: ${{ steps.release.outputs['rust/noosphere--tag_name'] }}
anything_was_released:
orb_released: ${{ steps.release.outputs['typescript/packages/orb--release_created'] }}
orb_release_tag_name: ${{ steps.release.outputs['typescript/packages/orb--tag_name'] }}
any_crate_was_released:
${{ steps.release.outputs['rust/noosphere--release_created'] ||
steps.release.outputs['rust/noosphere-api--release_created'] ||
steps.release.outputs['rust/noosphere-cli--release_created'] ||
Expand All @@ -39,13 +41,9 @@ jobs:
id: release
uses: cdata/release-please-action@main
with:
config-file: rust/release-please-config.json
manifest-file: rust/.release-please-manifest.json
token: ${{ secrets.GITHUB_TOKEN }}
default-branch: main
component: 'rust'
command: manifest
release-type: rust
extra-files: |
Cargo.toml
Expand Down Expand Up @@ -141,16 +139,17 @@ jobs:
name: swift-package-manifest
path: ./Package.swift

update-typescript-noosphere-version:
name: 'Update TypeScript Noosphere version'
# Publishes crates to crates.io in dependency order. This command is
# idempotent and won't re-publish crates that are already published, so it's
# safe for us to run it indiscriminately
publish-crates:
name: 'Publish to crates.io'
needs: ['release-please']
if: ${{ needs['release-please'].outputs.noosphere_released }}
runs-on: ubuntu-latest
if: ${{ needs['release-please'].outputs.any_crate_was_released }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ hashFiles('./rust/noosphere/examples/version_diff.rs') }}
- uses: actions-rs/toolchain@v1
with:
override: true
Expand All @@ -159,82 +158,112 @@ jobs:
- name: 'Install environment packages'
run: |
sudo apt-get update -qqy
sudo apt-get install jq
sudo apt-get install protobuf-compiler cmake libssl-dev pkg-config
- name: 'Install cargo-workspaces'
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-workspaces
- name: 'Publish crates'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo workspaces publish --from-git

curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel
- name: Import Subconscious Ops GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v5
orb-release-artifacts:
name: 'Add @subconsciousnetwork/orb artifacts to release'
runs-on: ubuntu-latest
needs: ['release-please']
if: ${{ needs.release-please.outputs.orb_released }}
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- uses: google/wireit@setup-github-actions-caching/v1
- uses: actions-rs/toolchain@v1
with:
gpg_private_key: ${{ secrets.CDATA_GPG_KEY }}
passphrase: ${{ secrets.CDATA_GPG_PASSWORD }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
- name: 'Update TypeScript Noosphere version'
id: update-noosphere-version
run: |
export NOOSPHERE_METADATA_FILE="./typescript/packages/orb/.noosphere_metadata.json"
export CURRENT_VERSION=`jq .version $NOOSPHERE_METADATA_FILE | xargs echo`
export LATEST_VERSION=`./dasel -f ./rust/noosphere/Cargo.toml .package.version | xargs echo`
export COMMIT_PREFIX=`cargo run --package noosphere --example version_diff -- --left $CURRENT_VERSION --right $LATEST_VERSION`
if [ $COMMIT_PREFIX = "ERROR" ]; then
exit 1
else
echo "$( jq --arg VERSION $LATEST_VERSION '.version = $VERSION' $NOOSPHERE_METADATA_FILE )" > $NOOSPHERE_METADATA_FILE
echo "commit-prefix=$COMMIT_PREFIX" >> $GITHUB_OUTPUT
echo "noosphere-version=$LATEST_VERSION" >> $GITHUB_OUTPUT
fi
- name: 'Create PR for updated file'
uses: peter-evans/create-pull-request@v4.0.2
override: true
profile: minimal
toolchain: stable
- uses: actions/setup-node@v3
with:
committer: ${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>
token: ${{ secrets.CDATA_GITHUB_TOKEN }}
commit-message: '${{ steps.update-noosphere-version.outputs.commit-prefix }} Update `noosphere` version to ${{ steps.update-noosphere-version.outputs.noosphere-version }}'
title: '${{ steps.update-noosphere-version.outputs.commit-prefix }} Update `noosphere` version to ${{ steps.update-noosphere-version.outputs.noosphere-version }} for TypeScript packages'
body: >
:robot: I have updated a cross-workspace dependency *beep* *boop*
---
This PR was generated automatically in response to the release of the Rust `noosphere` crate.
This change updates the release version of the `noosphere` crate that is associated with a pending release of our TypeScript/NPM packages.
You should make a call to land this PR (or defer it) __before__ performing a release of any TypeScript/NPM packages, as it weighs in the balance when considering how to increment the versions of those packages.
node-version: lts/*
- name: 'Install environment packages'
run: |
sudo apt-get update -qqy
sudo apt-get install jq protobuf-compiler cmake
- name: 'Install Rust/WASM test dependencies'
run: |
rustup target install wasm32-unknown-unknown
cargo install cargo-quickinstall
cargo quickinstall toml-cli
WASM_BINDGEN_VERSION=`toml get ./Cargo.lock . | jq '.package | map(select(.name == "wasm-bindgen"))[0].version' | xargs echo`
cargo quickinstall wasm-bindgen-cli --vers "$WASM_BINDGEN_VERSION"
**NOTE:** the commit message for this change has been specifically chosen to reflect the severity of changes in the Rust dependency, so make sure to preserve it when merging this PR!
wget https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz
tar -xvf ./binaryen-version_111-x86_64-linux.tar.gz
sudo mv ./binaryen-version_111/bin/wasm-opt $RUNNER_TOOL_CACHE/
shell: bash
- name: 'Install NPM dependencies'
working-directory: ./typescript
run: |
npm ci
npm run build
- name: 'Generate build artifacts'
id: generate-build-artifacts
working-directory: ./typescript/packages/orb
run: |
export ARCHIVE_NAME=`npm pack`
openssl dgst -sha256 ./$ARCHIVE_NAME > ./$ARCHIVE_NAME.sha256
echo "archive-name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
# NOTE: The release has to be published before adding build artifacts,
# otherwise the upload causes a different release to be made (???)
- name: 'Publish release'
run: gh release edit ${{ needs.release-please.outputs.orb_release_tag_name }} --draft=false --repo=cdata/noosphere
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Add build artifacts to release'
uses: softprops/action-gh-release@v1
with:
files: |
./typescript/packages/orb/${{ steps.generate-build-artifacts.outputs.archive-name }}
./typescript/packages/orb/${{ steps.generate-build-artifacts.outputs.archive-name }}.sha256
tag_name: ${{ needs.release-please.outputs.orb_release_tag_name }}

# Publishes crates to crates.io in dependency order. This command is
# idempotent and won't re-publish crates that are already published, so it's
# safe for us to run it indiscriminately
publish-crates:
name: 'Publish to crates.io'
needs: ['release-please']
publish-npm-packages:
name: 'Publish NPM packages'
runs-on: ubuntu-latest
if: ${{ needs['release-please'].outputs.anything_was_released }}
needs: ['release-please']
if: ${{ needs.release-please.outputs.orb_released }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- uses: google/wireit@setup-github-actions-caching/v1
- uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
toolchain: stable
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: 'Install environment packages'
run: |
sudo apt-get update -qqy
sudo apt-get install protobuf-compiler cmake libssl-dev pkg-config
- name: 'Install cargo-workspaces'
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-workspaces
- name: 'Publish crates'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo workspaces publish --from-git
sudo apt-get install jq protobuf-compiler cmake
- name: 'Install Rust/WASM test dependencies'
run: |
rustup target install wasm32-unknown-unknown
cargo install cargo-quickinstall
cargo quickinstall toml-cli
WASM_BINDGEN_VERSION=`toml get ./Cargo.lock . | jq '.package | map(select(.name == "wasm-bindgen"))[0].version' | xargs echo`
cargo quickinstall wasm-bindgen-cli --vers "$WASM_BINDGEN_VERSION"
wget https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz
tar -xvf ./binaryen-version_111-x86_64-linux.tar.gz
sudo mv ./binaryen-version_111/bin/wasm-opt $RUNNER_TOOL_CACHE/
shell: bash
- name: 'Install NPM dependencies'
working-directory: ./typescript
run: npm ci
- name: 'Publish @subconsciousnetwork/orb to NPM'
working-directory: ./typescript/packages/orb
run: npm publish
130 changes: 0 additions & 130 deletions .github/workflows/release_typescript.yaml

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 97599b9

Please sign in to comment.