Skip to content

Commit

Permalink
CI: various fixes in 'gitpublish.sh' (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 10, 2020
1 parent 4a9b8ba commit a723c29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit a723c29

Please sign in to comment.