fix(all): π minor fixes #461
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: build-push-and-deploy-containers | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build-push-and-deploy-containers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Prepare Meta Data for Build | |
id: prep | |
run: | | |
branch=${GITHUB_REF##*/} | |
sha=${GITHUB_SHA::8} | |
fullsha=${GITHUB_SHA} | |
ts=$(date +%s) | |
echo "::set-output name=BUILD_ID::${branch}-${sha}-${ts}" | |
echo "::set-output name=GIT_SHA::${fullsha}" | |
- name: π Checkout | |
uses: actions/checkout@v4 | |
- name: π Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: π Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: π Docker Login | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.digitalocean.com/openarabic/ | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: π Install Helm | |
uses: Azure/setup-helm@v3 | |
with: | |
version: ${{ env.HELM_VERSION_TO_INSTALL }} | |
env: | |
HELM_VERSION_TO_INSTALL: 3.12.0 | |
- name: π Login to Registry With Helm | |
run: | | |
helm registry login registry.digitalocean.com/openarabic --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: π Replace Commit SHA in Footer in Web | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["web/src/components/footer.js"]' | |
tokenPrefix: "@(" | |
tokenSuffix: ")@" | |
env: | |
GIT_SHA: ${{ steps.prep.outputs.GIT_SHA }} | |
- name: π¦ Build and Push API to Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./api/Dockerfile | |
tags: registry.digitalocean.com/openarabic/api:${{ steps.prep.outputs.BUILD_ID }} | |
context: ./api | |
push: true | |
- name: π¦ Build and Push Web to Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./web/Dockerfile | |
tags: registry.digitalocean.com/openarabic/web:${{ steps.prep.outputs.BUILD_ID }} | |
context: ./web | |
push: true | |
secrets: | | |
"REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}" | |
"REACT_APP_KEY=${{ secrets.REACT_APP_KEY }}" | |
"REACT_APP_GOOGLE_API_KEY=${{ secrets.REACT_APP_GOOGLE_API_KEY }}" | |
- name: π Replace SHA Tag for Containers and Helm Chart | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["package/**/*.yaml"]' | |
env: | |
BUILD_ID: ${{ steps.prep.outputs.BUILD_ID }} | |
# https://github.com/marketplace/actions/kubescape | |
- name: π Lint and Package | |
working-directory: ./package | |
run: ./build.sh | |
- name: π Publish Chart to Registry | |
working-directory: ./package | |
env: | |
HELM_EXPERIMENTAL_OCI: 1 | |
run: | | |
helm push dist/open-arabic-helm*.tgz oci://registry.digitalocean.com/openarabic |