Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cdata committed Dec 18, 2022
1 parent 5f035ee commit 42f0437
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 14 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/release_rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main

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

jobs:
# NOTE: This step is stateful. When there are unreleased changes on main, it
Expand Down Expand Up @@ -145,13 +145,8 @@ jobs:
needs: ['release-please']
if: ${{ needs['release-please'].outputs.noosphere_released }}
runs-on: ubuntu-latest
# permissions:
# id-token: write
# pull-requests: write
# contents: write
steps:
- uses: actions/checkout@v3
# - uses: chainguard-dev/actions/setup-gitsign@main
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ hashFiles('./rust/noosphere/examples/version_diff.rs') }}
Expand All @@ -166,9 +161,6 @@ jobs:
sudo apt-get install jq
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
# cargo install cargo-quickinstall
# cargo quickinstall toml-cli
- name: Import Subconscious Ops GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v5
Expand Down Expand Up @@ -197,12 +189,12 @@ jobs:
uses: peter-evans/create-pull-request@v4.0.2
with:
committer: ${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>
# author: ${{ 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.
Expand Down
129 changes: 129 additions & 0 deletions .github/workflows/release_typescript.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
on:
push:
branches:
- main

name: 'Perform a release (TypeScript)'

jobs:
# NOTE: This step is stateful. See comments in `release_rust.yaml`
release-please:
name: 'Prepare a release'
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository_owner == 'cdata'
outputs:
orb_released: ${{ steps.release.outputs['typescript/packages/orb--release_created'] }}
orb_release_tag_name: ${{ steps.release.outputs['typescript/packages/orb--tag_name'] }}
steps:
- uses: chainguard-dev/actions/setup-gitsign@main
- name: 'Run release-please'
id: release
uses: cdata/release-please-action@main
with:
config-file: typescript/release-please-config.json
manifest-file: typescript/.release-please-manifest.json
token: ${{ secrets.GITHUB_TOKEN }}
default-branch: main
command: manifest
release-type: node
extra-files: |
Cargo.toml
orb-release-artifacts:
name: 'Publish NPM packages'
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:
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 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
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 }}

publish-npm-packages:
name: 'Publish NPM packages'
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:
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 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
10 changes: 7 additions & 3 deletions .github/workflows/run_test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ jobs:
- name: 'Install Rust/WASM test dependencies'
run: |
rustup target install wasm32-unknown-unknown
cargo install toml-cli
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 install wasm-bindgen-cli --vers "$WASM_BINDGEN_VERSION"
cargo install wasm-opt --locked
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
# See: https://github.com/SeleniumHQ/selenium/blob/5d108f9a679634af0bbc387e7e3811bc1565912b/.github/actions/setup-chrome/action.yml
- name: 'Setup Chrome and chromedriver'
Expand Down
7 changes: 6 additions & 1 deletion typescript/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
"typescript/packages/orb": {}
"typescript/packages/orb": {
"extra-files": [
"typescript/packages/orb/.noosphere_metadata.json"
],
"draft": true
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

0 comments on commit 42f0437

Please sign in to comment.