Skip to content

Commit

Permalink
chore: ci-cd dev pipeline for test
Browse files Browse the repository at this point in the history
  • Loading branch information
khanti42 committed Nov 25, 2024
1 parent fecbf54 commit 62c0a25
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 18 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/deploy-wallet-get-starknet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Deploy Wallet-UI and Get-starknet

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
type: environment
required: true

jobs:
prepare-deployment:
environment: production
environment: dev
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -19,22 +25,34 @@ jobs:
- name: Prepare Parameters
id: prepare_parameters
run: |
ENV=${{ inputs.environment }}
BASE=$(node -p "require('./packages/starknet-snap/package.json').version")
ENV=production
{
echo "AWS_CLOUDFRONT_DISTRIBUTIONS_ID=${{ vars.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}"
echo "AWS_S3_GET_STARKNET_URL=${{ vars.AWS_S3_GET_STARKNET_URL }}"
echo "AWS_S3_URL=${{ vars.AWS_S3_URL }}"
echo "GET_STARKNET_PUBLIC_PATH=${{ vars.GET_STARKNET_PUBLIC_PATH }}"
echo "VERSION=${BASE}"
echo "TAG=latest"
echo "ENV=prod"
} >> "$GITHUB_OUTPUT"
if [[ $ENV == "dev" ]]; then
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y%m%d)
{
echo "VERSION=${BASE}-dev-${HASH}-${DATE}"
echo "ENV=dev"
} >> "$GITHUB_OUTPUT"
elif [[ $ENV == "production" ]]; then
{
echo "VERSION=${BASE}"
echo "ENV=prod"
} >> "$GITHUB_OUTPUT"
else
echo "Invalid environment"
exit 1
fi
outputs:
VERSION: ${{ steps.prepare_parameters.outputs.VERSION }}
TAG: ${{ steps.prepare_parameters.outputs.TAG }}
ENV: ${{ steps.prepare_parameters.outputs.ENV }}
AWS_S3_GET_STARKNET_URL: ${{ steps.prepare_parameters.outputs.AWS_S3_GET_STARKNET_URL }}
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ steps.prepare_parameters.outputs.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
AWS_S3_URL: ${{ steps.prepare_parameters.outputs.AWS_S3_URL }}
Expand Down Expand Up @@ -67,7 +85,7 @@ jobs:
echo "Building Get Starknet with GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH"
SNAP_VERSION="${VERSION}$" GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH yarn workspace @consensys/get-starknet build
SNAP_VERSION="${VERSION}" GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH yarn workspace @consensys/get-starknet build
env:
VERSION: ${{ needs.prepare-deployment.outputs.VERSION }}
GET_STARKNET_PUBLIC_PATH: ${{ needs.prepare-deployment.outputs.GET_STARKNET_PUBLIC_PATH }}
Expand All @@ -85,6 +103,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- prepare-deployment
- install-build
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
40 changes: 30 additions & 10 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Publish NPM

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
type: environment
required: true

jobs:
prepare-deployment:
environment: production
environment: dev
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -19,16 +25,30 @@ jobs:
- name: Prepare Parameters
id: prepare_parameters
run: |
ENV=${{ inputs.environment }}
BASE=$(node -p "require('./packages/starknet-snap/package.json').version")
ENV=production
{
echo "VERSION=${BASE}"
echo "TAG=latest"
echo "ENV=prod"
echo "LOG_LEVEL=0"
} >> "$GITHUB_OUTPUT"

if [[ $ENV == "dev" ]]; then
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y%m%d)
{
echo "VERSION=${BASE}-dev-${HASH}-${DATE}"
echo "TAG=dev"
echo "ENV=dev"
echo "LOG_LEVEL=6"
} >> "$GITHUB_OUTPUT"
elif [[ $ENV == "production" ]]; then
{
echo "VERSION=${BASE}"
echo "TAG=latest"
echo "ENV=prod"
echo "LOG_LEVEL=0"
} >> "$GITHUB_OUTPUT"
else
echo "Invalid environment"
exit 1
fi
echo $GITHUB_OUTPUT
outputs:
VERSION: ${{ steps.prepare_parameters.outputs.VERSION }}
TAG: ${{ steps.prepare_parameters.outputs.TAG }}
Expand Down

0 comments on commit 62c0a25

Please sign in to comment.