Skip to content

Commit

Permalink
fix(ci): fix napi release (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
YassinEldeeb authored Jan 26, 2024
1 parent a5b2eb5 commit b0d0c17
Show file tree
Hide file tree
Showing 15 changed files with 4,719 additions and 1,650 deletions.
99 changes: 65 additions & 34 deletions .github/workflows/napi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,9 @@ env:
permissions:
contents: write
id-token: write
'on':
push:
branches:
- main
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request: null
on:
release:
types: [created]
jobs:
build:
strategy:
Expand All @@ -37,13 +27,21 @@ jobs:
set -e &&
yarn build --target x86_64-unknown-linux-gnu &&
strip *.node
- host: macos-latest-xlarge
target: aarch64-apple-darwin
build: |
yarn build --target aarch64-apple-darwin
strip -x *.node
name: stable - ${{ matrix.settings.target }} - node@18
runs-on: ${{ matrix.settings.host }}
defaults:
run:
working-directory: libs/napi
run:
working-directory: libs/napi
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
Expand Down Expand Up @@ -92,45 +90,78 @@ jobs:
name: bindings-${{ matrix.settings.target }}
path: libs/napi/${{ env.APP_NAME }}.*.node
if-no-files-found: error

publish:
name: Publish
publish-lib:
name: Publish Lib
runs-on: ubuntu-latest
defaults:
run:
working-directory: libs/napi
run:
working-directory: libs/napi
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: yarn install
- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
path: artifacts
path: libs/napi/artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash

- name: Update version to match release tag and commit
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
npm version $TAG_NAME --no-git-tag-version
cd ../../bin/npm
npm version $TAG_NAME --no-git-tag-version
cd ../..
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add .
git commit -m "ci: bump napi packages' versions to $TAG_NAME"
git push
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish
run: |
npm config set provenance true
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-bin:
name: Publish Bin
runs-on: ubuntu-latest
defaults:
run:
working-directory: bin/npm
needs:
- publish-lib
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Publish
run: |
npm config set provenance true
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
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 0 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
name: release conductor

# on:
# push:
# branches:
# - master
# - main
# pull_request:
# release:
# types: [created]
on:
push:
branches:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ codegen-units = 1

[patch.crates-io]
minitrace = { git = "https://github.com/dotansimha/minitrace-rust.git", rev = "2f3bad8297db0f9b980e3f69e73401ce957dccd1" }

[profile.release.graphql-conductor_lib]
lto = true
5 changes: 3 additions & 2 deletions bin/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "@graphql-conductor/bin",
"version": "1.0.1",
"version": "0.0.4-alpha.0",
"description": "",
"main": "index.js",
"bin": {
"conductor": "./index.js"
},
"repository": "https://github.com/the-guild-org/conductor",
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@graphql-conductor/lib": "latest"
"@graphql-conductor/lib": "0.0.10"
}
}
212 changes: 0 additions & 212 deletions libs/napi/.github/workflows/CI.yml

This file was deleted.

Loading

0 comments on commit b0d0c17

Please sign in to comment.