-
Notifications
You must be signed in to change notification settings - Fork 68
69 lines (54 loc) · 2.4 KB
/
publish-dev-packages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Publish @devtion
on:
push:
branches:
- dev
jobs:
npm-publish-dev:
runs-on: ubuntu-22.04
environment: dev
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
cache: yarn
- name: Initialize Project
run: |
yarn install
yarn build
env:
NODE_OPTIONS: "--max_old_space_size=4096"
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
- name: Update package.json dependencies and names
run: |
# Enable recursive globbing
shopt -s globstar
# Update package.json dependencies
sed -i -e 's/"@p0tion\/actions": "[^"]*"/"@devtion\/actions": "latest"/g' ./packages/backend/package.json
sed -i -e 's/"@p0tion\/actions": "[^"]*"/"@devtion\/actions": "latest"/g' ./packages/phase2cli/package.json
# Update package names
sed -i -e 's/"name": "@p0tion\/phase2cli"/"name": "@devtion\/devcli"/g' ./packages/phase2cli/package.json
sed -i -e 's/"name": "@p0tion\/backend"/"name": "@devtion\/backend"/g' ./packages/backend/package.json
sed -i -e 's/"name": "@p0tion\/actions"/"name": "@devtion\/actions"/g' ./packages/actions/package.json
# Update string literals in TypeScript and JS files
find packages -type f -name '*.ts' ! -path '*/node_modules/*' -exec sed -i 's|p0tion/actions|devtion/actions|g' {} +
find packages -type f -name '*.js' ! -path '*/node_modules/*' -exec sed -i 's|p0tion/actions|devtion/actions|g' {} +
- name: Install lerna
run: |
npm install -g [email protected]
- name: Publish packages
run: |
# Prevent `git commit error` when running `lerna version`
# It will not be pushed to GitHub. It is ephemeral
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git add .
git commit -m "chore: publish packages" --no-verify
echo "${{ vars.CLI_ENV_FILE }}" > ./packages/phase2cli/dist/.env
lerna version 0.0.0-$(git rev-parse --short HEAD~1) --no-push --ignore-scripts --message "chore(release): publish packages" --yes
lerna publish from-git --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}