Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Merge pull request #292 from NFDI4Chem/development #342

Merge pull request #292 from NFDI4Chem/development

Merge pull request #292 from NFDI4Chem/development #342

Workflow file for this run

name : nmrXiv documentation - Github Actions
on:
push:
branches: [development,main]
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: nmrxiv-dev
GKE_ZONE: europe-west3-a
DEPLOYMENT_NAME: doc-nmrxiv-doc
IMAGE: nmrxiv-doc
REPOSITORY_NAME: nmrxiv-dev
jobs:
build:
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '16.17.0'
- name: Test Build
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
#needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
# Configure docker to use the gcloud command-line tool as a credential helper
- run: |-
gcloud auth configure-docker europe-west3-docker.pkg.dev
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}
# Build the Docker image
- name: Build
run: |-
docker build -f ./devops/Dockerfile \
--tag "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
# Push the Docker image to Google Container Registry
- name: Publish
run: |-
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest"
# # Set up kustomize
# - name: Set up Kustomize
# run: |-
# curl --location https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.2.0/kustomize_v4.2.0_linux_amd64.tar.gz | tar xz
# chmod u+x ./kustomize
# # Deploy the Docker image to the GKE cluster
# - name: Deploy
# run: |-
# ./kustomize edit set image eu.gcr.io/PROJECT_ID/IMAGE:TAG=eu.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA
# ./kustomize build . | kubectl apply -f -
# kubectl rollout status deployment/$DEPLOYMENT_NAME
# kubectl get services -o wide
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
kubectl get services -o wide
build-Algolia:
# Build the Algolia Index.
name: Build Algolia Index
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: setup-build-publish-deploy
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run the docker crawl command.
run: |-
docker run --env-file=.env -e "CONFIG=$(cat ./config.json | jq -r tostring)" algolia/docsearch-scraper