Skip to content

Commit

Permalink
Generic names, generic paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kj4ezj committed Jul 7, 2024
1 parent d8fbd0f commit b7e0e42
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/frontend-aws-context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ set -eo pipefail
if [[ "$GITHUB_REF_TYPE" == 'tag' ]]; then
echo "Found git $GITHUB_REF_TYPE \"$GITHUB_REF_NAME,\" attempting a production deployment."
export GIT_TAG="$(git --no-pager tag --points-at HEAD)"
export FRONTEND_VERSION="v$(cat frontend/package.json | jq -r '.version')"
export FRONTEND_VERSION="v$(cat package.json | jq -r '.version')"
if [[ "$FRONTEND_VERSION" != "$GIT_TAG" || "$GIT_TAG" != "$GITHUB_REF_NAME" ]]; then
echo '::error title=Version String Mismatch:: Frontend package.json version string does not match the git tag!'
echo "FRONTEND_VERSION='$FRONTEND_VERSION'"
echo "GITHUB_REF_NAME='$GITHUB_REF_NAME'"
echo "GIT_TAG='$GIT_TAG'"
cat frontend/package.json | jq '.'
cat package.json | jq '.'
exit 10
fi
echo '::notice title=Deploying to Production::This build will attempt to deploy to production. This is the real deal!'
echo '::set-output name=dry-run::false'
echo "::set-output name=role-arn::$DEVHUB_FRONTEND_PROD_IAM_ARN"
echo "::set-output name=role-arn::$FRONTEND_PROD_IAM_ARN"
else
echo "Found git $GITHUB_REF_TYPE \"$GITHUB_REF_NAME,\" performing a dry-run."
echo '::notice title=Dry Run::This build is performing a dry run. A dry run attemps to verify everything is good to go without actually changing anything.'
echo '::set-output name=dry-run::true'
echo "::set-output name=role-arn::$DEVHUB_FRONTEND_RO_IAM_ARN"
echo "::set-output name=role-arn::$FRONTEND_RO_IAM_ARN"
fi
echo 'Done. - frontend-aws-role.sh'
16 changes: 8 additions & 8 deletions .github/workflows/frontend-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ exec 9>&1 # enable tee to write to STDOUT as a file
ee node --version
ee yarn --version
ee npm --version
if [[ ! -z "$DEVHUB_BACKEND_API" ]]; then
ee 'printf "$DEVHUB_BACKEND_API" | wc -c'
export BACKEND_API_TEST='curl -fsSL "$DEVHUB_BACKEND_API/test"'
if [[ ! -z "$BACKEND_API" ]]; then
ee 'printf "$BACKEND_API" | wc -c'
export BACKEND_API_TEST='curl -fsSL "$BACKEND_API/test"'
echo "$ $BACKEND_API_TEST"
export BACKEND_UP="$(eval "$BACKEND_API_TEST" | tee >(cat - >&9))"
echo
if [[ "$BACKEND_UP" == 'true' ]]; then
echo 'DevHub backend API is up!'
echo 'Backend API is up!'
else
printf '\e[93mWARNING: Failed to connect to DevHub backend API!\e[0m\n'
echo '::warning title=Failed to Connect to DevHub Backend API::Failed to connect to DevHub backend API!'
printf '\e[93mWARNING: Failed to connect to backend API!\e[0m\n'
echo '::warning title=Failed to Connect to Backend API::Failed to connect to backend API!'
fi
else
printf '\e[93mWARNING: DEVHUB_BACKEND_API is not defined!\e[0m\n'
echo '::warning title=DevHub Backend API Endpoint Missing::DEVHUB_BACKEND_API is not defined!'
printf '\e[93mWARNING: BACKEND_API is not defined!\e[0m\n'
echo '::warning title=Backend API Endpoint Missing::BACKEND_API is not defined!'
fi
# init
ee pushd frontend
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DevHub Frontend CICD
name: Staking Frontend CICD

on: [push, workflow_dispatch]

Expand Down Expand Up @@ -26,13 +26,13 @@ jobs:
- name: Static Frontend Build - node v${{ matrix.node-version }}
run: .github/workflows/frontend-build.sh
env:
DEVHUB_BACKEND_API: ${{ secrets.DEVHUB_BACKEND_API }}
BACKEND_API: ${{ secrets.BACKEND_API }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist-node-${{ matrix.node-version }}
path: frontend/dist.tar.gz
path: dist.tar.gz

aws:
name: AWS Authentication
Expand All @@ -49,8 +49,8 @@ jobs:
id: aws-context
run: .github/workflows/frontend-aws-context.sh
env:
DEVHUB_FRONTEND_PROD_IAM_ARN: ${{ secrets.DEVHUB_FRONTEND_PROD_IAM_ARN }}
DEVHUB_FRONTEND_RO_IAM_ARN: ${{ secrets.DEVHUB_FRONTEND_RO_IAM_ARN }}
FRONTEND_PROD_IAM_ARN: ${{ secrets.FRONTEND_PROD_IAM_ARN }}
FRONTEND_RO_IAM_ARN: ${{ secrets.FRONTEND_RO_IAM_ARN }}

- name: Authenticate to AWS
uses: aws-actions/configure-aws-credentials@v1-node16
Expand All @@ -65,6 +65,6 @@ jobs:
- name: Publish Frontend
run: .github/workflows/frontend-publish.sh
env:
CF_DISTRIBUTION: ${{ secrets.DEVHUB_FRONTEND_PROD_CF_DISTRIBUTION }}
CF_DISTRIBUTION: ${{ secrets.FRONTEND_PROD_CF_DISTRIBUTION }}
DRY_RUN: ${{ steps.aws-context.outputs.dry-run }}
S3_BUCKET: ${{ secrets.DEVHUB_FRONTEND_PROD_S3_BUCKET }}
S3_BUCKET: ${{ secrets.FRONTEND_PROD_S3_BUCKET }}

0 comments on commit b7e0e42

Please sign in to comment.