feat(governance,trading,explorer): split steps by logic (#3387)
This commit is contained in:
parent
ccadbc2cb6
commit
45f2e926c3
1
.github/workflows/ci-cd-trigger.yml
vendored
1
.github/workflows/ci-cd-trigger.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- release/*
|
||||||
|
- develop
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
|
48
.github/workflows/publish-dist.yml
vendored
48
.github/workflows/publish-dist.yml
vendored
@ -37,18 +37,25 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
||||||
- name: Check node version
|
- name: Define variables
|
||||||
id: tags
|
id: tags
|
||||||
run: |
|
run: |
|
||||||
nodeVersion=$(cat .nvmrc | head -n 1)
|
|
||||||
echo ::set-output name=nodeVersion::${nodeVersion}
|
|
||||||
|
|
||||||
if [[ "${{ github.event_name }}" = "push" ]]; then
|
if [[ "${{ github.event_name }}" = "push" ]]; then
|
||||||
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
|
domain="vega.rocks"
|
||||||
bucketName="${{ github.event.repository.name }}-$envName"
|
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then
|
||||||
|
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
|
||||||
|
if [[ "${{ github.ref }}" =~ .*mainnet.* ]]; then
|
||||||
|
domain="vega.community"
|
||||||
|
fi
|
||||||
|
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
|
||||||
|
envName="stagnet3"
|
||||||
|
fi
|
||||||
|
bucketName="${{ matrix.app }}.${envName}.${domain}"
|
||||||
echo ::set-output name=bucketName::${bucketName}
|
echo ::set-output name=bucketName::${bucketName}
|
||||||
echo ::set-output name=envName::${envName}
|
echo ::set-output name=envName::${envName}
|
||||||
fi
|
fi
|
||||||
|
nodeVersion=$(cat .nvmrc | head -n 1)
|
||||||
|
echo ::set-output name=nodeVersion::${nodeVersion}
|
||||||
|
|
||||||
- name: Build and export to local Docker
|
- name: Build and export to local Docker
|
||||||
id: docker_build
|
id: docker_build
|
||||||
@ -68,14 +75,15 @@ jobs:
|
|||||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat ipfs-hash
|
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat ipfs-hash
|
||||||
|
|
||||||
echo "List html directory"
|
echo "List html directory"
|
||||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local ls -lah
|
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local sh -c 'apk add --update tree; tree .'
|
||||||
|
|
||||||
echo "Copy dist to local filesystem"
|
- name: Copy dist to local filesystem
|
||||||
|
run: |
|
||||||
docker create --name=dist ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
docker create --name=dist ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
||||||
docker cp dist:/usr/share/nginx/html dist
|
docker cp dist:/usr/share/nginx/html dist
|
||||||
|
|
||||||
echo "Check local dist"
|
echo "check local dist files"
|
||||||
ls -al dist
|
tree dist
|
||||||
|
|
||||||
- name: Publish dist as docker image
|
- name: Publish dist as docker image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
@ -88,14 +96,18 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
|
|
||||||
# - uses: shallwefootball/s3-upload-action@master
|
# bucket creation in github.com/vegaprotocol/terraform//frontend
|
||||||
# if: ${{ github.event_name == 'push' }}
|
- name: Publish dist to s3
|
||||||
# name: Upload dist S3
|
uses: jakejarvis/s3-sync-action@master
|
||||||
# with:
|
if: ${{ github.event_name == 'push' }}
|
||||||
# aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
with:
|
||||||
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
args: --acl private --follow-symlinks --delete
|
||||||
# aws_bucket: ${{ steps.tags.outputs.bucketName }}
|
env:
|
||||||
# source_dir: 'dist'
|
AWS_S3_BUCKET: ${{ steps.tags.outputs.bucketName }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_REGION: 'eu-west-1'
|
||||||
|
SOURCE_DIR: 'dist/${{ matrix.app }}'
|
||||||
|
|
||||||
- name: Add preview label
|
- name: Add preview label
|
||||||
uses: actions-ecosystem/action-add-labels@v1
|
uses: actions-ecosystem/action-add-labels@v1
|
||||||
|
@ -24,5 +24,6 @@ EXPOSE 80
|
|||||||
# Copy dist
|
# Copy dist
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
COPY --from=build /app/dist/apps/${APP} /usr/share/nginx/html
|
COPY --from=build /app/dist/apps/${APP} /usr/share/nginx/html
|
||||||
RUN apk add --no-cache go-ipfs; ipfs init && echo "$(ipfs add -rQ .)" > ipfs-hash; apk del go-ipfs
|
RUN apk add --no-cache go-ipfs; ipfs init && echo "$(ipfs add -rQ .)" > ipfs-hash; apk del go-ipfs
|
||||||
|
@ -5,7 +5,9 @@ export PATH="/app/node_modules/.bin:$PATH"
|
|||||||
flags="--network-timeout 100000 --pure-lockfile"
|
flags="--network-timeout 100000 --pure-lockfile"
|
||||||
|
|
||||||
if [[ ! -z "${ENV_NAME}" ]]; then
|
if [[ ! -z "${ENV_NAME}" ]]; then
|
||||||
flags="--env=${ENV_NAME} $flags"
|
if [[ "${ENV_NAME}" != "ops-vega" ]]; then
|
||||||
|
flags="--env=${ENV_NAME} $flags"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${APP}" = "trading" ]; then
|
if [ "${APP}" = "trading" ]; then
|
||||||
@ -16,7 +18,3 @@ if [ "${APP}" = "trading" ]; then
|
|||||||
else
|
else
|
||||||
yarn nx build ${APP} $flags
|
yarn nx build ${APP} $flags
|
||||||
fi
|
fi
|
||||||
|
|
||||||
env_vars_file="/app/dist/apps/${APP}/.env"
|
|
||||||
# make sure there are no exposed .env files
|
|
||||||
rm $env_vars_file || echo "No env vars file"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user