-
Notifications
You must be signed in to change notification settings - Fork 52
46 lines (35 loc) · 1.42 KB
/
docker.yml
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
name: Manual Release Build and Docker Image
on:
repository_dispatch:
types: [specmatic-core-release]
workflow_dispatch:
jobs:
build-and-dockerize:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Docker Login
run: echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Read version from properties
id: read_version
run: |
echo "Reading version from version.properties..."
version=$(grep 'version=' version.properties | cut -d'=' -f2)
echo "Version: $version"
echo "::set-output name=VERSION::$version"
- name: Build Docker Image
run: docker build --no-cache -t znsio/specmatic:${{ steps.read_version.outputs.VERSION }} .
- name: Push Docker Image
run: docker push znsio/specmatic:${{ steps.read_version.outputs.VERSION }}
- name: Tag as latest
run: docker tag znsio/specmatic:${{ steps.read_version.outputs.VERSION }} znsio/specmatic:latest && docker push znsio/specmatic:latest