Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 4 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ env:
APP_NAME: ngrok
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
workflow_call:
secrets:
NGROK_AUTHTOKEN:
required: true
push:
branches:
- '**'
Expand Down Expand Up @@ -506,62 +510,3 @@ jobs:
name: bindings-universal-apple-darwin
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error

publish:
if: github.ref == 'refs/heads/main' && github.repository == 'ngrok/ngrok-javascript'
name: Publish
runs-on: ubuntu-latest
needs:
- udeps
- fmt
- clippy
- build-freebsd
- test-windows-msvc-binding
- test-linux-x64-gnu-binding
- test-linux-x64-musl-binding
- test-linux-aarch64-gnu-binding
- test-linux-aarch64-musl-binding
- test-linux-arm-gnueabihf-binding
- universal-macOS
steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move artifacts
run: yarn artifacts

- name: List packages
run: ls -R ./npm
shell: bash

- name: Publish
run: |
echo "git log:"
git log -1 --pretty=%B
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

name: Publish

on:
pull_request:
branches: [main]

jobs:
ci:
name: Run CI checks
uses: ./.github/workflows/ci.yml
secrets:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}

publish:
name: Publish
runs-on: ubuntu-latest
needs: ci
if: github.ref == 'refs/heads/main' && github.repository == 'ngrok/ngrok-javascript'
steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move artifacts
run: yarn artifacts

- name: List packages
run: ls -R ./npm
shell: bash

- name: Publish
run: |
# extract version from Cargo.toml
version=$(grep '^version =' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
echo "Package version: $version"
npm publish --access public
# check version variable and publish accordingly
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
elif [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Tag Release
run: |
git config user.name "GitHub Action"
git config user.email noreply@ngrok.com
version=$(grep '^version =' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
tag="v$version"
echo "Tagging release: $tag"
echo "Fetching all tags in the repository"
git fetch --tags
if git rev-parse "$tag" > /dev/null 2>&1; then
echo "Tag $tag already exists, skipping tag creation."
else
echo "Tag $tag does not exist, pushing tag."
git tag -a -m "Version ${version}" $tag
git push --tags
fi
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
url = "2.4.0"
aws-lc-rs = "=1.13.0"
aws-lc-sys = "=0.28.0"
[target.'cfg(target_os = "android")'.dependencies]
aws-lc-sys = { version = "0.28.0", default-features = false }

[build-dependencies]
napi-build = "2.0.1"
Expand Down
Loading