forked from ml4ai/skema
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (74 loc) · 2.31 KB
/
publish.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
# Automatically build Docker images on changes to main and push them to a
# Container Registry using HCL Bake file.
name: Build and Publish
on:
push:
branches: ['main']
tags: ['*']
jobs:
tag-generator:
name: Determine image tag
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ steps.generate.outputs.tag }}
steps:
- name: Generate appropriate tag
id: generate
run: |
if [[ '${{ github.ref_type }}' == 'branch' && '${{ github.ref_name }}' == 'main' ]]; then
TAG=latest
else
SEMVER=$( echo ${{ github.ref_name }} | sed -nre 's/^v[^0-9]*(([0-9]+\.)*[0-9]+(-[a-z]+)?).*/\1/p')
if [[ -n $SEMVER ]]; then
TAG=${SEMVER}
else
TAG=${{ github.ref_name }}
fi
fi
echo "$TAG"
echo "tag=${TAG,,}" >> ${GITHUB_OUTPUT}
- name: Show Generated Tag
run: echo ${{ steps.generate.outputs.tag }}
make-dockerfile:
name: Create skema-text-reading Dockerfile
runs-on: ubuntu-22.04
needs:
- tag-generator
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Setup JDK (w/ SBT)
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Generate and Push to main the Text Reading app and its Dockerfile
working-directory: ./skema/text_reading/scala
env:
APP_VERSION: steps.generate.outputs.tag
run: |
sbt "webapp/docker/stage"
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "generated text-reading"
git push
bake:
needs:
- tag-generator
- make-dockerfile
uses: darpa-askem/.github/.github/workflows/bake-publish.yaml@main
with:
# Tell bake-publish.yaml that this is the Dockerfile to use
artifact: 'Dockerfile'
file: 'docker-bake.hcl'
group: 'prod'
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
tag: ${{ needs.tag-generator.outputs.image-tag }}
secrets:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}