-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from IDEA-Research/dev
Merge to release
- Loading branch information
Showing
66 changed files
with
1,979 additions
and
936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: app-frontend-cd | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*-app*' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
build: | ||
if: github.repository_owner == 'deepdataspace' | ||
runs-on: self-hosted | ||
outputs: | ||
PORT: ${{ steps.check_env_vars.outputs.PORT }} | ||
NAMESPACE: ${{ steps.check_env_vars.outputs.NAMESPACE }} | ||
steps: | ||
- name: Checkout deepdataspace | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get Git Tag | ||
id: get_git_tag | ||
run: echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT | ||
|
||
- name: Set Environment Variables | ||
run: | | ||
# parse git tag | ||
gitTag="${{ steps.get_git_tag.outputs.tag }}" | ||
echo "GIT_TAG=${gitTag}" >> $GITHUB_ENV | ||
# parse namespace | ||
if [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-appdev[0-9]+ ]]; then | ||
namespace=dev | ||
port=7002 | ||
elif [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-apptest[0-9]+ ]]; then | ||
namespace=test | ||
port=7003 | ||
elif [[ "${gitTag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-app[0-9]+ ]]; then | ||
namespace=prod | ||
port=7004 | ||
else | ||
echo "Invalid git tag. Pipeline terminated." | ||
exit 1 | ||
fi | ||
echo "NAMESPACE=${namespace}" >> $GITHUB_ENV | ||
echo "PORT=${port}" >> $GITHUB_ENV | ||
- name: Check Environment Variables | ||
id: check_env_vars | ||
run: | | ||
echo env.PORT=${{ env.PORT }} | ||
echo env.NAMESPACE=${{ env.NAMESPACE }} | ||
echo "PORT=${{ env.PORT }}" >> $GITHUB_OUTPUT | ||
echo "NAMESPACE=${{ env.NAMESPACE }}" >> $GITHUB_OUTPUT | ||
- name: Checkout deepdataspace-app-env | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: deepdataspace/deepdataspace-app-env | ||
ref: 'main' | ||
path: deepdataspace-app-env | ||
token: ${{ secrets.DDS_ORG_GITHUB_TOKEN }} | ||
|
||
- name: Copy Frontend Build Env File | ||
run: | | ||
NAMESPACE=${{ env.NAMESPACE }} | ||
cp deepdataspace-app-env/app/.env.${NAMESPACE} packages/app/.env.local | ||
echo "TAG_VERSION=${{ env.GIT_TAG }}" >> packages/app/.env.local | ||
cp deepdataspace-app-env/app/Dockerfile packages/app | ||
cp deepdataspace-app-env/app/nginx.conf packages/app | ||
rm -rf deepdataspace-app-env | ||
- name: Build Docker Image | ||
run: | | ||
NAMESPACE=${{ env.NAMESPACE }} | ||
pnpm i --frozen-lockfile | ||
cd packages/app | ||
pnpm run build | ||
docker image build -f ./Dockerfile -t dds-app-${NAMESPACE}-frontend:latest . | ||
deploy: | ||
if: github.repository_owner == 'deepdataspace' | ||
runs-on: self-hosted | ||
needs: build | ||
steps: | ||
- name: Stop Running Docker | ||
run: | | ||
PORT=${{ needs.build.outputs.PORT }} | ||
CONTAINER_ID=`docker ps -a | grep ${PORT} | cut -d " " -f 1` | ||
docker stop ${CONTAINER_ID} | ||
docker rm ${CONTAINER_ID} | ||
continue-on-error: true | ||
|
||
- name: Run New Docker Image | ||
run: | | ||
PORT=${{ needs.build.outputs.PORT }} | ||
NAMESPACE=${{ needs.build.outputs.NAMESPACE }} | ||
sleep 1 | ||
docker run --restart=always -d -p ${PORT}:80 dds-app-${NAMESPACE}-frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.