feat: enhance tool creation UI with workflow language options #50
Workflow file for this run
This file contains hidden or 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
name: Publish packages | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
linters: | |
name: Linting checks | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Get node version | |
id: node | |
run: | | |
echo "::set-output name=version::$(node -v)" | |
- name: Get node_modules cache | |
uses: actions/cache@v4 | |
id: node_modules | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{ steps.node.outputs.version }} | |
- name: Install dependencies | |
run: npm install | |
- name: Run linters | |
run: npm run lint | |
# tests: | |
# name: Test checks | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 2 | |
# - name: Use Node.js 20.x | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 20.x | |
# - name: Get node version | |
# id: node | |
# run: | | |
# echo "::set-output name=version::$(node -v)" | |
# - name: Get node_modules cache | |
# uses: actions/cache@v4 | |
# id: node_modules | |
# with: | |
# path: | | |
# **/node_modules | |
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{ steps.node.outputs.version }} | |
# - name: Install dependencies | |
# run: npm ci | |
# - name: Install playwright browsers | |
# run: | | |
# sudo apt update | |
# npx playwright install --with-deps | |
# - name: Build | |
# run: npm run build | |
# - name: Run tests | |
# run: npm run test | |
bump-monorepo: | |
name: Bump monorepo | |
runs-on: ubuntu-latest | |
needs: | |
- linters | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Remove 'v' from RELEASE_VERSION | |
run: | | |
echo "Original RELEASE_VERSION: $RELEASE_VERSION" | |
RELEASE_VERSION=$(echo "$RELEASE_VERSION" | sed 's/^v//') | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
shell: bash | |
- name: Install SSH Client | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Git user config | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: npm ci | |
- name: Update root package version | |
run: npm version $RELEASE_VERSION --no-git-tag-version | |
- name: Update all package versions | |
run: | | |
# Custom ignore list (includes eslint-config which we don't want to bump) | |
IGNORE_PACKAGES="ecc-docs,@elixir-cloud/ro-crate,@elixir-cloud/tes,@elixir-cloud/eslint-config" | |
echo "Ignore list: $IGNORE_PACKAGES" | |
# Find all package.json files and update versions, excluding all node_modules directories | |
find . -name "package.json" \ | |
-not -path "*/node_modules/*" \ | |
-not -path "./.git/*" \ | |
-not -path "./.changeset/*" \ | |
-not -path "./.github/*" \ | |
-not -path "./.husky/*" \ | |
-not -path "./.turbo/*" | while read package_file; do | |
if [ "$package_file" != "./package.json" ]; then | |
# Extract package name from package.json | |
PACKAGE_NAME=$(node -e " | |
try { | |
const pkg = require('$package_file'); | |
console.log(pkg.name || ''); | |
} catch(e) { | |
console.log(''); | |
} | |
") | |
# Check if package should be ignored | |
if [ -n "$PACKAGE_NAME" ]; then | |
SHOULD_IGNORE=$(echo "$IGNORE_PACKAGES" | grep -q "$PACKAGE_NAME" && echo "true" || echo "false") | |
if [ "$SHOULD_IGNORE" = "false" ]; then | |
echo "Updating $PACKAGE_NAME in $package_file to version $RELEASE_VERSION" | |
# Update version in package.json | |
node -e " | |
const fs = require('fs'); | |
const pkg = JSON.parse(fs.readFileSync('$package_file', 'utf8')); | |
if (!pkg.private) { | |
pkg.version = '$RELEASE_VERSION'; | |
fs.writeFileSync('$package_file', JSON.stringify(pkg, null, 2) + '\n'); | |
} | |
" | |
else | |
echo "Skipping $PACKAGE_NAME (in ignore list)" | |
fi | |
fi | |
fi | |
done | |
- name: ReInstall Dependencies | |
run: | | |
npm install | |
- name: Commit version | |
run: | | |
git add . | |
git commit -m "bump: v$RELEASE_VERSION" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
force-with-lease: true | |
ssh: true | |
branch: main | |
publish: | |
name: Publish on npm | |
runs-on: ubuntu-latest | |
needs: bump-monorepo | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Remove 'v' from RELEASE_VERSION | |
run: | | |
echo "Original RELEASE_VERSION: $RELEASE_VERSION" | |
RELEASE_VERSION=$(echo "$RELEASE_VERSION" | sed 's/^v//') | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
shell: bash | |
- name: Setup Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Login to npm | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Install Dependencies | |
run: npm ci | |
- name: Update internal dependencies | |
run: | | |
# Custom ignore list (includes eslint-config which we don't want to update dependencies for) | |
IGNORE_PACKAGES="ecc-docs,@elixir-cloud/ro-crate,@elixir-cloud/tes,@elixir-cloud/eslint-config" | |
echo "Ignore list: $IGNORE_PACKAGES" | |
echo "Updating internal @elixir-cloud dependencies to version $RELEASE_VERSION" | |
# Only process package.json files in workspace directories (apps/* and packages/*) | |
for workspace_dir in apps packages; do | |
if [ -d "$workspace_dir" ]; then | |
find "$workspace_dir" -maxdepth 2 -name "package.json" -not -path "*/node_modules/*" | while read package_file; do | |
# Extract package name from package.json | |
PACKAGE_NAME=$(node -e " | |
try { | |
const pkg = require('./$package_file'); | |
console.log(pkg.name || ''); | |
} catch(e) { | |
console.log(''); | |
} | |
") | |
# Check if package should be processed (not in ignore list and starts with @elixir-cloud) | |
if [ -n "$PACKAGE_NAME" ]; then | |
SHOULD_IGNORE=$(echo "$IGNORE_PACKAGES" | grep -q "$PACKAGE_NAME" && echo "true" || echo "false") | |
IS_ELIXIR_CLOUD=$(echo "$PACKAGE_NAME" | grep -q "^@elixir-cloud/" && echo "true" || echo "false") | |
if [ "$SHOULD_IGNORE" = "false" ] && [ "$IS_ELIXIR_CLOUD" = "true" ]; then | |
echo "Updating internal dependencies in $PACKAGE_NAME ($package_file)" | |
# Update dependencies, devDependencies, and peerDependencies | |
node -e " | |
const fs = require('fs'); | |
const pkg = JSON.parse(fs.readFileSync('./$package_file', 'utf8')); | |
let updated = false; | |
// Function to update dependencies in a section | |
const updateDepsSection = (section, sectionName) => { | |
if (pkg[section]) { | |
Object.keys(pkg[section]).forEach(depName => { | |
if (depName.startsWith('@elixir-cloud/')) { | |
// Check if this dependency is not in ignore list | |
const ignoreList = '$IGNORE_PACKAGES'.split(','); | |
const shouldIgnoreDep = ignoreList.includes(depName); | |
if (!shouldIgnoreDep && pkg[section][depName] !== '$RELEASE_VERSION') { | |
console.log(\` Updating \${depName} in \${sectionName}: \${pkg[section][depName]} -> $RELEASE_VERSION\`); | |
pkg[section][depName] = '$RELEASE_VERSION'; | |
updated = true; | |
} | |
} | |
}); | |
} | |
}; | |
// Update all dependency sections | |
updateDepsSection('dependencies', 'dependencies'); | |
updateDepsSection('devDependencies', 'devDependencies'); | |
updateDepsSection('peerDependencies', 'peerDependencies'); | |
// Write back if any updates were made | |
if (updated) { | |
fs.writeFileSync('./$package_file', JSON.stringify(pkg, null, 2) + '\n'); | |
} | |
" | |
fi | |
fi | |
done | |
fi | |
done | |
- name: Build Packages | |
run: npm run build | |
- name: Publish to npm | |
run: npm run release |