fix(flat-pages): avoid JavaScript protocol in redirect URL (#2135) #552
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
name: Deploy Flat Web Dev | |
on: | |
push: | |
branches: | |
- "main" | |
- "only-deploy-prod-web" | |
jobs: | |
deploy-flat-web-dev: | |
environment: development | |
env: | |
FLAT_UA: ${{ secrets.FLAT_UA }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Restore Cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: | | |
node ./scripts/ci/remove-workspace-packages.js web | |
node ./scripts/ci/remove-package-scripts-hooks.js | |
# failure automatically retries 3 times | |
pnpm i || pnpm i || pnpm i | |
- name: Build flat web development | |
run: pnpm -F flat-web build:cn -m development | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Reset dockerignore | |
run: | | |
echo "*" > .dockerignore | |
echo "!web/flat-web/dist" >> .dockerignore | |
echo "!web/flat-web/deploy/nginx" >> .dockerignore | |
- name: Build and push images | |
env: | |
COMMIT_SHA_TAG: development-${{ github.sha }} | |
LATEST_DEV_TAG: dev-latest | |
PRIVATE_DOCKERHUB_REGISTRY: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }} | |
PRIVATE_DOCKERHUB_USERNAME: ${{ secrets.PRIVATE_DOCKERHUB_USERNAME }} | |
PRIVATE_DOCKERHUB_PASSWORD: ${{ secrets.PRIVATE_DOCKERHUB_PASSWORD }} | |
run: | | |
docker build . -f web/flat-web/deploy/Dockerfile -t agoraflat/flat-web:$COMMIT_SHA_TAG -t agoraflat/flat-web:$LATEST_DEV_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$COMMIT_SHA_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$LATEST_DEV_TAG | |
docker push agoraflat/flat-web:$COMMIT_SHA_TAG | |
docker push agoraflat/flat-web:$LATEST_DEV_TAG | |
docker login -u $PRIVATE_DOCKERHUB_USERNAME -p $PRIVATE_DOCKERHUB_PASSWORD $PRIVATE_DOCKERHUB_REGISTRY | |
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$COMMIT_SHA_TAG | |
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$LATEST_DEV_TAG | |
- name: Prep helm chart | |
env: | |
DOCKER_IMAGE_NAME: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}/agoraflat/flat-web | |
DOCKER_IMAGE_TAG: development-${{ github.sha }} | |
run: | | |
export APPVERSION=development-${{ github.sha }} | |
export CHART=./web/flat-web/helm/Chart.yaml | |
sed -i "s/^appVersion:.*$/appVersion: $APPVERSION/" $CHART | |
export VALUE=./web/flat-web/helm/values.yaml | |
sed -i "s|DOCKER_IMAGE_NAME|$DOCKER_IMAGE_NAME|" $VALUE | |
sed -i "s|DOCKER_IMAGE_TAG|$DOCKER_IMAGE_TAG|" $VALUE | |
- name: Deploy | |
uses: WyriHaximus/github-action-helm3@v2 | |
with: | |
exec: helm upgrade flat-web ./web/flat-web/helm --install --wait --atomic --namespace=default --set replicaCount=2 | |
kubeconfig: "${{ secrets.KUBECONFIG }}" |