forked from subconsciousnetwork/noosphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
144 additions
and
14 deletions.
There are no files selected for viewing
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
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
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 |
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
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