chore(version): upgrade version to v2.3.5 #35
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 Prod | |
on: | |
push: | |
branches: | |
- "stable" | |
- "only-deploy-prod-web" | |
jobs: | |
deploy-flat-web-prod: | |
environment: production | |
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: Install dependencies | |
env: | |
FLAT_AGREEMENT_URL: ${{ vars.FLAT_AGREEMENT_URL }} | |
run: | | |
echo "FLAT_AGREEMENT_URL=$FLAT_AGREEMENT_URL" >> config/CN/.env.production | |
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 production | |
run: pnpm -F flat-web build:cn -m production | |
- 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 production | |
env: | |
COMMIT_SHA_TAG: production-${{ github.sha }} | |
LATEST_PROD_TAG: 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_PROD_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$COMMIT_SHA_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web:$LATEST_PROD_TAG | |
docker push agoraflat/flat-web:$COMMIT_SHA_TAG | |
docker push agoraflat/flat-web:$LATEST_PROD_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_PROD_TAG | |
- name: Prep helm chart | |
env: | |
DOCKER_IMAGE_NAME: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}/agoraflat/flat-web | |
DOCKER_IMAGE_TAG: production-${{ github.sha }} | |
run: | | |
export APPVERSION=production-${{ 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 | |
kubeconfig: "${{ secrets.KUBECONFIG }}" |