Skip to content

Commit

Permalink
Fix missing variables in deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa committed Nov 29, 2020
1 parent c9a7b77 commit 6c53b3a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_TAG: ${{ github.event.release.tag_name }}
GITHUB_REPO_SLUG: ${{ github.repository }}
GITHUB_BUILD_NUMBER: ${{ github.run_number }}
DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }}
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy-manually.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ posix_read "Tag" GITHUB_TAG
posix_read "Repo slug (e.g. hikari-py/hikari)" GITHUB_REPO_SLUG

git checkout "${GITHUB_TAG}"
GITHUB_COMMIT=$(git rev-parse HEAD)
echo "Detected GITHUB_COMMIT to be ${GITHUB_COMMIT}"
GITHUB_SHA=$(git rev-parse HEAD)
echo "Detected GITHUB_SHA to be ${GITHUB_SHA}"

set -x
rm public -Rf || true
Expand Down
28 changes: 16 additions & 12 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@
# SOFTWARE.
set -e

VERSION=${GITHUB_TAG}
REF=${GITHUB_COMMIT}

echo "===== INSTALLING DEPENDENCIES ====="
python -m pip install \
setuptools \
wheel \
nox \
twine \
requests \
-r requirements.txt

echo "Defined environment variables"
env | grep -oP "^[^=]+" | sort

if [ -z ${GITHUB_TAG+x} ]; then echo '$GITHUB_TAG environment variable is missing' && exit 1; fi
if [ -z "${GITHUB_TAG}" ]; then echo '$GITHUB_TAG environment variable is empty' && exit 1; fi
if [ -z ${GITHUB_SHA+x} ]; then echo '$GITHUB_SHA environment variable is missing' && exit 1; fi
if [ -z "${GITHUB_SHA}" ]; then echo '$GITHUB_SHA environment variable is empty' && exit 1; fi
if [ -z ${GITHUB_TOKEN+x} ]; then echo '$GITHUB_TOKEN environment variable is missing' && exit 1; fi
if [ -z "${GITHUB_TOKEN}" ]; then echo '$GITHUB_TOKEN environment variable is empty' && exit 1; fi
if [ -z ${DEPLOY_WEBHOOK_URL+x} ]; then echo '$DEPLOY_WEBHOOK_URL environment variable is missing' && exit 1; fi
Expand All @@ -44,6 +36,18 @@ if [ -z "${TWINE_USERNAME}" ]; then echo '$TWINE_USERNAME environment variable i
if [ -z ${TWINE_PASSWORD+x} ]; then echo '$TWINE_PASSWORD environment variable is missing' && exit 1; fi
if [ -z "${TWINE_PASSWORD}" ]; then echo '$TWINE_PASSWORD environment variable is empty' && exit 1; fi

VERSION=${GITHUB_TAG}
REF=${GITHUB_SHA}

echo "===== INSTALLING DEPENDENCIES ====="
python -m pip install \
setuptools \
wheel \
nox \
twine \
requests \
-r requirements.txt

echo "-- Bumping repository version to ${VERSION} (ref: ${REF}) --"
sed "s|^__version__.*|__version__ = \"${VERSION}\"|g" -i hikari/_about.py
sed "s|^__git_sha1__.*|__git_sha1__ = \"${REF}\"|g" -i hikari/_about.py
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
webhook_url = os.environ["DEPLOY_WEBHOOK_URL"]
tag = os.environ["GITHUB_TAG"]
build_no = os.environ["GITHUB_BUILD_NUMBER"]
commit_sha = os.environ["GITHUB_COMMIT"]
commit_sha = os.environ["GITHUB_SHA"]

payload = dict(
username="Github Actions",
Expand Down

0 comments on commit 6c53b3a

Please sign in to comment.