Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: various fixes in 'gitpublish.sh' #2639

Merged
merged 1 commit into from Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -238,7 +238,7 @@ jobs:
- name: Build Deno package
run: npm run build:deno

- name: Deploy to `npm` branch
- name: Deploy to `deno` branch
run: npm run gitpublish:deno
env:
GH_TOKEN: ${{ secrets.GH_NPM_BRANCH_PUBLISH_TOKEN }}
11 changes: 8 additions & 3 deletions resources/gitpublish.sh
Expand Up @@ -14,13 +14,18 @@ DIST_DIR=$2
set -e

if [ ! -d $DIST_DIR ]; then
echo "Directory `${DIST_DIR}` does not exist!"
echo "Directory '${DIST_DIR}' does not exist!"
exit 1;
fi;

if [ -z "${GH_TOKEN}" ]; then
echo 'Must provide GH_TOKEN as environment variable!'
exit 1;
fi;

# Create empty directory
rm -rf $BRANCH
git clone -b $BRANCH "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" $BRANCH
git clone -b $BRANCH -- "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" $BRANCH

# Remove existing files first
rm -rf $BRANCH/**/*
Expand All @@ -41,7 +46,7 @@ git add -A .
if git diff --staged --quiet; then
echo "Nothing to publish"
else
git commit -a -m "Deploy $HEADREV to `$BRANCH` branch"
git commit -a -m "Deploy $HEADREV to '$BRANCH' branch"
git push > /dev/null 2>&1
echo "Pushed"
fi