Merge branch 'main' of https://github.com/dappforce/grillchat into de… #1472
Workflow file for this run
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: Feature based build and deploy grillchat | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- deploy/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
grillchat_build: | |
name: build & Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract branch name | |
shell: bash | |
run: echo "name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/^deploy\///')" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Prepare | |
id: prep | |
run: | | |
echo "image=dappforce/subsocial-web-app:grillchat-${{ env.name }}-$(echo $GITHUB_SHA | head -c7)" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to DockerHub | |
uses: docker/login-action@master | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-single-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-single-buildx | |
- name: Build docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
file: docker/Dockerfile | |
push: true | |
build-args: | | |
GH_SERVER_MNEMONIC=plunge pumpkin penalty segment cattle more print below fat lemon clap uniform | |
GH_SERVER_DISCUSSION_CREATOR_MNEMONIC=plunge pumpkin penalty segment cattle more print below fat lemon clap uniform | |
GH_CAPTCHA_SECRET=6LeWW0QlAAAAABwWU1iEEb2RlfRRbj8fz2X04iNW | |
GH_SUBSOCIAL_PROMO_SECRET_HEX=0x836aa9c5e78c3aebb3526e6bc14b10e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Y2FkMjNmZjM5MGVmODQ1MzdhMGI2MWI4YWQ1NDY1ZGI1ZjI1NjZkMWJmMjc3MGE1OTQyMzFmNzFmYzA5YWVlZGJhNzJkZjM5Y2Y4NDIxMTQ3YzJkNWQyNTFkNDZjNGQyMDFlOGM1MmUzZTFjIn0= | |
GH_NEXT_PUBLIC_CAPTCHA_SITE_KEY=6LeWW0QlAAAAAL1u_pgngcjyH211q3dipMItu_5f | |
GH_NEXT_PUBLIC_SPACE_IDS=1002,1005,1010,1011,1023,1025,1030 | |
GH_MODERATION_URL=https://staging-moderation.subsocial.network/graphql | |
GH_MODERATION_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZX0.Ao4w7g-TvV-o5KgxEiHvSgdxN6MAe0mHe7jS0ZT5rLY | |
GH_NOTIFICATIONS_URL=https://staging-grill-notifications.subsocial.network/graphql | |
GH_NOTIFICATIONS_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZX0.ff24KWuoI8DJD1npesUMB6cVYTlOkwQYQBUOBcOpJxc | |
GH_NEXT_PUBLIC_AMP_ID=19b9413e325bc2321fae1ea80cfb2915 | |
GH_NEXT_PUBLIC_SQUID_URL=https://squid.subsquid.io/xsocial/graphql | |
GH_NEXT_PUBLIC_COMMUNITY_HUB_ID=1025 | |
GH_NEXT_PUBLIC_GA_ID=G-FT28TL1W3M | |
GH_IPFS_WRITE_URL=https://gw-seattle.crustcloud.io | |
GH_IPFS_PIN_URL=https://test-pin.crustcloud.io/psa | |
GH_COVALENT_API_KEY=cqt_rQtDdp9G9DFvqcGjVPDD4FFCyhFQ | |
GH_NEXT_PUBLIC_NOTIFICATION_APP_ID=BJaKjx7xtiIXtSUT8tR6VDG0WwhFwdqOqp8L5kc6alGBUtndnlV_DUJ6sze_z70VEBOKk4AT_wZTJqE9dC7sbEQ | |
GH_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=gl-notifications-dev.firebaseapp.com | |
GH_NEXT_PUBLIC_FIREBASE_PROJECT_ID=gl-notifications-dev | |
GH_NEXT_PUBLIC_FIREBASE_API_KEY=AIzaSyC7pSekdJQ0PpUDCY4eEkEeDGCazVES6QI | |
GH_NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=gl-notifications-dev.appspot.com | |
GH_NEXT_PUBLIC_FIREBASE_MESSAGING_ID=581626459774 | |
GH_NEXT_PUBLIC_FIREBASE_APP_ID=1:581626459774:web:6b7098eb48c0b142f50a2f | |
GH_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=G-ZJBCKJR5F3 | |
target: runner | |
tags: | | |
${{ env.image }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
deploy: | |
name: deploy | |
needs: grillchat_build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v3 | |
- name: Extract branch name | |
shell: bash | |
run: echo "name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/^deploy\///')" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN_STAGING }} | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.K8S_STAGING }} | |
- name: Update docker image name | |
run: TAG=${{ env.name }}-$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|dappforce/subsocial-web-app:grillchat-'${TAG}'|' $GITHUB_WORKSPACE/deployment/features/deployment.yaml | |
- name: Update svc & ingress file | |
run: NAME=${{ env.name }} && sed -i 's|<BRANCH>|'${NAME}'|' $GITHUB_WORKSPACE/deployment/features/all.yaml | |
- name: Update deploy file | |
run: NAME=${{ env.name }} && sed -i 's|<BRANCH>|'${NAME}'|' $GITHUB_WORKSPACE/deployment/features/deployment.yaml | |
- name: Deploy to DigitalOcean Kubernetes | |
run: kubectl apply -f $GITHUB_WORKSPACE/deployment/features/ | |
- name: Verify deployment | |
run: NAME=${{ env.name }} && kubectl -n sub-back rollout status deployment/grillchat-${NAME} | |
- name: CF deploy | |
run: curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/dns_records" -H "X-Auth-Email:${{ secrets.CF_MAIL }}" -H "Authorization:Bearer ${{ secrets.CF_TOKEN }}" -H "Content-Type:application/json" --data '{"type":"A","name":"${{ env.name }}-grillchat.subsocial.network","content":"174.138.105.155","ttl":3600,"priority":10,"proxied":true}' |