initial commit #3
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: Typesense and or Noske Indexer | ||
on: | ||
workflow_dispatch: {} | ||
env: | ||
ORG: acdh-oeaw | ||
REPO: acdh-indexer | ||
DATA_DIR: data/editions | ||
PROJECT: acdh-indexer | ||
jobs: | ||
fetch_data: | ||
name: Fetch Data from ${{ github.env.DATA_DIR }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache the site | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-site-build | ||
with: | ||
path: ./${{ github.env.DATA_DIR }} | ||
key: | ||
build-${{ env.cache-name }}-${{ hashFiles('**/fetch-data.sh') }} | ||
restore-keys: | | ||
build-${{ env.cache-name }}- | ||
build- | ||
- name: Fetch data | ||
run: ./shellscripts/fetch_data.sh | ||
typesense_index: | ||
needs: [fetch_data] | ||
name: Build Typesense Index | ||
runs-on: ubuntu-latest | ||
env: | ||
TYPESENSE_HOST: typesense.acdh-dev.oeaw.ac.at | ||
TYPESENSE_PORT: 443 | ||
TYPESENSE_PROTOCOL: https | ||
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-site-build | ||
with: | ||
path: ./${{ github.env.DATA_DIR }} | ||
key: | ||
build-${{ env.cache-name }}-${{ hashFiles('**/fetch-data.sh') }} | ||
restore-keys: | | ||
build-${{ env.cache-name }}- | ||
build- | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: "pipenv" | ||
- name: Install dependencies | ||
run: | | ||
python --version | ||
python -m pip install pipenv | ||
pipenv install | ||
- name: Build gestrich index data.jsonl | ||
run: pipenv run python typesense/index.py | ||
noske_index: | ||
needs: [fetch_data] | ||
name: Build Noske Index | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Cache editions | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-site-build | ||
with: | ||
path: | | ||
./${{ github.env.DATA_DIR }} | ||
key: | ||
build-${{ env.cache-name }}-${{ hashFiles('**/fetch-data.sh') }} | ||
restore-keys: | | ||
build-${{ env.cache-name }}- | ||
build- | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
cache: "pipenv" | ||
- name: Install dependencies | ||
run: | | ||
python --version | ||
python -m pip install pipenv | ||
pipenv install | ||
- name: Build verticals | ||
run: | | ||
pipenv run python noske/mk_verticals.py | ||
# - name: Commit data | ||
# uses: stefanzweifel/git-auto-commit-action@v4 | ||
# with: | ||
# commit_message: Verticals/Created | ||
- name: Create tags based on git data | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.env.ORG }}/${{ github.env.REPO }}/${{ github.env.PROJECT }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=raw,value={{sha}} | ||
- name: login to github container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: build and push to ghcr.io | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./nosketchengine/Dockerfile | ||
platforms: linux/amd64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
_3: | ||
needs: [noske_index] | ||
uses: ${{ github.env.ORG }}/gl-autodevops-minimal-port/.github/workflows/deploy.yml@main | ||
secrets: inherit | ||
with: | ||
DOCKER_TAG: ghcr.io/${{ github.env.ORG }}/${{ github.env.REPO }}/${{ github.env.PROJECT }}:latest | ||
APP_NAME: "${{ github.env.PROJECT }}" | ||
APP_ROOT: "/" | ||
POSTGRES_ENABLED: false | ||
environment: "${{ github.ref_name }}" | ||
default_port: "8080" |