ci: fixed canary publishing
This commit is contained in:
parent
62e8e3b33f
commit
f4ab514b18
5 changed files with 15 additions and 13 deletions
3
.github/workflows/test.yaml
vendored
3
.github/workflows/test.yaml
vendored
|
@ -80,6 +80,5 @@ jobs:
|
|||
continue-on-error: true
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.CANARY_NPM_TOKEN }}
|
||||
E2E: 1
|
||||
REGISTRY: 'https://npm.tei.su'
|
||||
run: cd e2e && node publish-canary.js
|
||||
run: cd e2e && ./cli.sh ci-publish
|
||||
|
|
|
@ -34,7 +34,11 @@ case "$method" in
|
|||
chmod -R 777 .verdaccio
|
||||
docker compose up -d verdaccio
|
||||
docker compose run --rm --build build
|
||||
docker compose run --rm --build test
|
||||
docker compose run --build test
|
||||
;;
|
||||
"ci-publish")
|
||||
export CURRENT_COMMIT=$(git rev-parse HEAD)
|
||||
docker compose run --rm -e REGISTRY -e NPM_TOKEN -e CURRENT_COMMIT test publish-canary
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command"
|
||||
|
|
|
@ -6,11 +6,8 @@ const fs = require('fs')
|
|||
const path = require('path')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
const { REGISTRY } = require('../scripts/publish.js')
|
||||
const { getCurrentCommit } = require('../scripts/git-utils.js')
|
||||
|
||||
// setup token
|
||||
const { NPM_TOKEN } = process.env
|
||||
const { NPM_TOKEN, REGISTRY, CURRENT_COMMIT } = process.env
|
||||
|
||||
if (!NPM_TOKEN) {
|
||||
console.error('NPM_TOKEN is not set!')
|
||||
|
@ -22,7 +19,7 @@ execSync(`npm config set //${REGISTRY.replace(/^https?:\/\//, '')}/:_authToken $
|
|||
const nodeModulesDir = path.join(__dirname, 'node_modules')
|
||||
const mtcuteDir = path.join(nodeModulesDir, '@mtcute')
|
||||
|
||||
const commit = getCurrentCommit().slice(0, 7)
|
||||
const commit = CURRENT_COMMIT.slice(0, 7)
|
||||
|
||||
for (const pkg of fs.readdirSync(mtcuteDir)) {
|
||||
const pkgJsonPath = path.join(mtcuteDir, pkg, 'package.json')
|
||||
|
|
|
@ -80,6 +80,7 @@ async function main() {
|
|||
if (!process.argv[2]) {
|
||||
console.log('Usage: node runner.js <what>')
|
||||
console.log(' where <what> is one of:')
|
||||
console.log(' publish-canary - publish everything to canary npm')
|
||||
console.log(' all - run all tests')
|
||||
console.log(' <dirname> - (one of %s) - run tests for that directory', DIRS.join(', '))
|
||||
console.log(' <dirname> <filename> - run tests for that file')
|
||||
|
@ -88,6 +89,12 @@ async function main() {
|
|||
|
||||
const [dir, file] = process.argv.slice(2)
|
||||
|
||||
if (dir === 'publish-canary') {
|
||||
cp.execSync('node publish-canary.js', { stdio: 'inherit' })
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (dir === 'all') {
|
||||
for (const d of DIRS) {
|
||||
console.log('Entering %s', d)
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
const cp = require('child_process')
|
||||
|
||||
function getCurrentCommit() {
|
||||
return cp.execSync('git rev-parse HEAD', { encoding: 'utf8', stdio: 'pipe' }).trim()
|
||||
}
|
||||
|
||||
function getLatestTag() {
|
||||
try {
|
||||
const res = cp.execSync('git describe --abbrev=0 --tags', { encoding: 'utf8', stdio: 'pipe' }).trim()
|
||||
|
@ -68,5 +64,4 @@ module.exports = {
|
|||
findChangedFilesSince,
|
||||
getCommitsSince,
|
||||
parseConventionalCommit,
|
||||
getCurrentCommit,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue