-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 2.14 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: news/docker
on:
workflow_run:
workflows: ["news/graphql", "news/machine_learning", "codeql"]
types:
- completed
env:
REGISTRY: ghcr.io
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master' }}
name: Publish news
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get GraphQL tag
id: "get-graphql-tag"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' graphql/Cargo.toml) >> $GITHUB_OUTPUT
- name: Build GraphQL image
run: |
docker build . -f docker/api/Dockerfile -t ghcr.io/gravitalia/news-api:latest .
docker push ghcr.io/lubmminy/polymath:latest
docker tag ghcr.io/gravitalia/news-graphql:latest ghcr.io/gravitalia/news-api:${{ steps.get-graphql-tag.outputs.PKG_VERSION }}
docker push ghcr.io/lubmminy/polymath:${{ steps.get-graphql-tag.outputs.PKG_VERSION }}
- name: Get ML tag
id: "get-ml-tag"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '/^version/ { gsub(/["]/, "", $2); print $2 }' machine_learning/pyproject.toml) >> $GITHUB_OUTPUT
- name: Build ML API image
run: |
docker build . -f docker/ml/Dockerfile -t ghcr.io/gravitalia/news-ml:latest .
docker tag ghcr.io/gravitalia/news-ml:latest ghcr.io/gravitalia/news-ml:${{ steps.get-ml-tag.outputs.PKG_VERSION }}
- name: Publish images
run: |
docker push ghcr.io/gravitalia/news-api:latest
docker push ghcr.io/gravitalia/news-api:${{ steps.get-graphql-tag.outputs.PKG_VERSION }}
docker push ghcr.io/gravitalia/news-ml:latest
docker push ghcr.io/gravitalia/news-ml:${{ steps.get-ml-tag.outputs.PKG_VERSION }}