Skip to content

Commit

Permalink
ci: publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Aug 15, 2024
1 parent 4eca244 commit 8e6759e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 18 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish to NPM

on:
workflow_dispatch:
inputs:
dry-run:
description: 'Do not touch or write anything, but show the commands'
default: true
type: boolean

jobs:
release-it:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14.17.3

- name: Remove .npmrc
run: |
rm -f .npmrc
shell: bash

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.5

- name: Install dependencies
run: |
npm install --agora_electron_publish_to_npm
shell: bash

- name: Setup NPM auth token
run: |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
- name: Dry Run Release
if: ${{ inputs.dry-run }}
run: |
npm publish --tag customer_hotfix --verbose --dry-run
- name: NPM Publish
if: ${{ !inputs.dry-run }}
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
npm publish --tag customer_hotfix --verbose
19 changes: 6 additions & 13 deletions just-task.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
const {
lipoCreate,
createTmpProduct,
createTmpVideoSourceProduct,
lipoCreateVideoSource,
backupSymbol,
restoreSymbols
} = require("./scripts/lipo");
const { lipoCreate, createTmpProduct,createTmpVideoSourceProduct,lipoCreateVideoSource } = require("./scripts/lipo");
const { task, option, logger, argv, series, condition } = require('just-task');
const path = require('path')
const semver = require("semver");
Expand Down Expand Up @@ -76,8 +69,7 @@ task("build:electron", async () => {
return;
}
if (argv().platform === "darwin" && isOver11) {
await backupSymbol("x86_64");
await buildMacArm64(electronVersion);
buildMacArm64(electronVersion);
}
}
});
Expand Down Expand Up @@ -105,9 +97,6 @@ const buildMacArm64 = async electronVersion => {
const arm64VDProConfig = await createTmpVideoSourceProduct();
lipoCreate(x86ProConfig, arm64ProConfig);
lipoCreateVideoSource(x86VDProConfig,arm64VDProConfig);

await backupSymbol("arm64");
await restoreSymbols();
}
});
};
Expand Down Expand Up @@ -147,6 +136,10 @@ task('install', () => {
arch:getArgvFromNpmEnv().arch || getArgvFromPkgJson().arch || process.arch,
}

if(config.publishToNpm) {
return;
}

// work-around
const addonVersion = packageVersion;
if (config.prebuilt) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"ts-node": "8.4.1",
"tslint": "5.20.1",
"typedoc": "^0.22.10",
"typescript": "^4.0.0"
"typescript": "^4.1.4"
},
"directories": {
"doc": "docs"
Expand Down
3 changes: 2 additions & 1 deletion scripts/npm_argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path')
module.exports.getArgvFromNpmEnv = () => {
return {
electronVersion: process.env.npm_config_agora_electron_dependent,
publishToNpm: process.env.npm_config_agora_electron_publish_to_npm,
prebuilt: process.env.npm_config_agora_electron_prebuilt === 'false' ? false : true ,
platform: process.env.npm_config_agora_electron_platform,
msvsVersion: process.env.npm_config_agora_electron_msvs_version,
Expand Down Expand Up @@ -39,4 +40,4 @@ module.exports.getArgvFromPkgJson = () => {
prebuilt: true
}
}
}
}

0 comments on commit 8e6759e

Please sign in to comment.