Skip to content

Commit 62aaa95

Browse files
chore: updated with workflow command which is not yet completed
0 parents  commit 62aaa95

File tree

24 files changed

+727
-0
lines changed

24 files changed

+727
-0
lines changed

.github/workflows/onPushToMain.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: version, tag and github release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
15+
- name: Check if version already exists
16+
id: version-check
17+
run: |
18+
package_version=$(node -p "require('./package.json').version")
19+
exists=$(gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1 && echo "true" || echo "")
20+
21+
if [ -n "$exists" ]; then
22+
echo "Version v$package_version already exists"
23+
echo "::warning file=package.json,line=1::Version v$package_version already exists - no release will be created. If you want to create a new release, please update the version in package.json and push again."
24+
echo "skipped=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "Version v$package_version does not exist. Creating release..."
27+
echo "skipped=false" >> $GITHUB_OUTPUT
28+
echo "tag=v$package_version" >> $GITHUB_OUTPUT
29+
fi
30+
env:
31+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
32+
33+
- name: Debug Git Config Secrets (optional)
34+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
35+
run: |
36+
echo "GH_EMAIL is set: ${{ secrets.GH_EMAIL != '' }}"
37+
echo "GH_USERNAME is set: ${{ secrets.GH_USERNAME != '' }}"
38+
39+
- name: Setup git
40+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
41+
run: |
42+
git config --global user.email "${{ secrets.GH_EMAIL || 'mdirshadengineer+github@gmail.com' }}"
43+
git config --global user.name "${{ secrets.GH_USERNAME || 'github-actions[bot]' }}"
44+
45+
- name: Generate oclif README
46+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
47+
id: oclif-readme
48+
run: |
49+
npm install
50+
npm exec oclif readme
51+
if [ -n "$(git status --porcelain)" ]; then
52+
git add .
53+
git commit -am "chore: update README.md"
54+
git push -u origin ${{ github.ref_name }}
55+
fi
56+
57+
- name: Create Github Release
58+
uses: ncipollo/release-action@v1
59+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
60+
with:
61+
name: ${{ steps.version-check.outputs.tag }}
62+
tag: ${{ steps.version-check.outputs.tag }}
63+
commit: ${{ github.ref_name }}
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
skipIfReleaseExists: true

.github/workflows/onRelease.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: latest
15+
- run: npm install
16+
- run: npm run build
17+
- run: npm run prepack
18+
- uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c
19+
with:
20+
token: ${{ secrets.NPM_TOKEN }}
21+
- run: npm run postpack

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: tests
2+
on:
3+
push:
4+
branches-ignore: [main]
5+
workflow_dispatch:
6+
7+
jobs:
8+
unit-tests:
9+
strategy:
10+
matrix:
11+
os: ['ubuntu-latest', 'windows-latest']
12+
node_version: [lts/-1, lts/*, latest]
13+
fail-fast: false
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node_version }}
20+
cache: npm
21+
- run: npm install
22+
- run: npm run build
23+
- run: npm run test

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*-debug.log
2+
*-error.log
3+
**/.DS_Store
4+
/.idea
5+
/dist
6+
/tmp
7+
/node_modules
8+
oclif.manifest.json
9+
10+
11+
12+
yarn.lock
13+
pnpm-lock.yaml
14+

.mocharc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"require": ["ts-node/register"],
3+
"watch-extensions": ["ts"],
4+
"recursive": true,
5+
"reporter": "spec",
6+
"timeout": 60000,
7+
"node-option": ["loader=ts-node/esm", "experimental-specifier-resolution=node"]
8+
}

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@oclif/prettier-config"

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "attach",
7+
"name": "Attach",
8+
"port": 9229,
9+
"skipFiles": ["<node_internals>/**"]
10+
},
11+
{
12+
"type": "node",
13+
"request": "launch",
14+
"name": "Execute Command",
15+
"skipFiles": ["<node_internals>/**"],
16+
"runtimeExecutable": "node",
17+
"runtimeArgs": ["--loader", "ts-node/esm", "--no-warnings=ExperimentalWarning"],
18+
"program": "${workspaceFolder}/bin/dev.js",
19+
"args": ["hello", "world"]
20+
}
21+
]
22+
}

0 commit comments

Comments
 (0)