Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit a7df45f

Browse files
author
Divyendu Singh
authored
1 parent bd376e1 commit a7df45f

File tree

7 files changed

+72
-11
lines changed

7 files changed

+72
-11
lines changed

.envrc_sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PRODUCTION=<1> # Default to dry-run, to actually publish, use PRODUCTION=1
2+
PAT=<Personal Access Token> # https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token

.github/workflows/publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Automatic Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
PAT: ${{ secrets.PAT }}
10+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
11+
PRODUCTION: ${{ secrets.PRODUCTION }}
12+
13+
jobs:
14+
publish:
15+
name: Publish
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Install Dependencies
20+
run: npm install
21+
- name: Publish Extension as Patch
22+
run: npm run vsce:publish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
.vscode/
66

77
.DS_Store
8+
.envrc

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@ tail -f <absolute-path> | grep ts-graphql-plugin-log
122122
## License
123123
124124
MIT
125+

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-graphql",
3-
"version": "0.2.2",
3+
"version": "0.2.7",
44
"preview": true,
55
"private": false,
66
"license": "MIT",
@@ -121,7 +121,10 @@
121121
"watch": "tsc -watch -p ./",
122122
"postinstall": "node ./node_modules/vscode/bin/install",
123123
"test": "npm run compile && node ./node_modules/vscode/bin/test",
124-
"package": "vsce package"
124+
"vsce:package": "vsce package",
125+
"env:source": "export $(cat .envrc | xargs)",
126+
"vsce:publish": "sh publish.sh",
127+
"upgrade-interactive": "npx npm-check -u"
125128
},
126129
"devDependencies": {
127130
"@types/capitalize": "1.0.1",
@@ -149,9 +152,9 @@
149152
"graphql-config": "2.2.1",
150153
"graphql-config-extension-prisma": "0.3.0",
151154
"graphql-language-service-server": "2.3.3",
152-
"graphql-tag": "2.10.1",
155+
"graphql-tag": "^2.10.3",
153156
"subscriptions-transport-ws": "0.9.16",
154157
"vscode-languageclient": "5.2.1",
155-
"ws": "7.2.1"
158+
"ws": "^7.2.3"
156159
}
157160
}

publish.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
echo "============================"
4+
echo "PAT: $PAT"
5+
echo "PRODUCTION: $PRODUCTION"
6+
echo "============================"
7+
8+
if [ "$PRODUCTION" = "1" ]; then
9+
git config --global user.email "[email protected]"
10+
git config --global user.name "Prismo"
11+
git remote add github "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git" || true
12+
else
13+
echo "Not setting up repo because PRODUCTION is not set"
14+
fi
15+
16+
if [ -z "$PAT" ]; then
17+
echo "\$PAT is empty. Please set the value of $PAT"
18+
elif [ -n "$PAT" ]; then
19+
if [ "$PRODUCTION" = "1" ]; then
20+
./node_modules/.bin/vsce publish patch --pat $PAT
21+
else
22+
echo "Printing the command because PRODUCTION is not set"
23+
echo "./node_modules/.bin/vsce publish patch --pat $PAT"
24+
fi
25+
fi
26+
27+
if [ "$PRODUCTION" = "1" ]; then
28+
git pull github "${GITHUB_REF}" --ff-only
29+
git push github HEAD:"${GITHUB_REF}"
30+
else
31+
echo "Not pushing because PRODUCTION is not set"
32+
fi

0 commit comments

Comments
 (0)