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
on: | |
push: | |
# branches: | |
# - main | |
env: | |
REGISTRY: ghcr.io | |
VERSION: v0.1.0 | |
# VERSION: ${{ github.event.release.tag_name }} | |
jobs: | |
# | |
# Build | |
# | |
build: | |
name: Build / ${{ matrix.config.service }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- config: | |
service: gateway | |
context: ./modules/services/gateway | |
- config: | |
service: database | |
context: ./modules/services/database/modules/database | |
- config: | |
service: database-bootstrap | |
context: ./modules/services/database/modules/bootstrap | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.config.context }} | |
# push: true | |
load: true | |
tags: | | |
ghcr.io/akdasa-studios/lectorium-${{ matrix.config.service }}:${{ env.VERSION }}-dev | |
- name: push docker image | |
run: | | |
docker push ghcr.io/akdasa-studios/lectorium-${{ matrix.config.service }}:${{ env.VERSION }}-dev | |
deploy-staging: | |
name: Deploy / Staging | |
runs-on: ubuntu-latest | |
environment: Staging | |
needs: build | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Promote Images | |
run: | | |
for service in gateway database database-bootstrap; do | |
docker pull ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-dev | |
docker tag ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-dev ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc | |
docker rmi ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-dev | |
docker push ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc | |
done | |
tests-e2e: | |
name: E2E Tests | |
runs-on: ubuntu-latest | |
needs: deploy-staging | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Run E2E Tests | |
run: | | |
echo "Running E2E tests" | |
echo "Tests passed" | |
deploy-production: | |
name: Deploy / Production | |
runs-on: ubuntu-latest | |
environment: Production | |
needs: deploy-staging | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Promote Images | |
run: | | |
for service in gateway database database-bootstrap; do | |
docker pull ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc | |
docker tag ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }} | |
docker tag ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc ghcr.io/akdasa-studios/lectorium-$service:latest | |
docker rmi ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-dev ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }}-rc | |
docker push ghcr.io/akdasa-studios/lectorium-$service:${{ env.VERSION }} | |
docker push ghcr.io/akdasa-studios/lectorium-$service:latest | |
done |