-
Notifications
You must be signed in to change notification settings - Fork 51
108 lines (89 loc) · 4.8 KB
/
build-tag-publish.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Gradle Build, Tag, and Publish OpenHouse
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-gradle-project:
name: Build tagged commit
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
distribution: 'microsoft'
java-version: '1.8'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
run: ./gradlew clean build
- name: Start Docker Containers
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml up -d --build
- name: Wait for Docker Containers to start
run: sleep 30
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install -r scripts/python/requirements.txt
- name: Run Integration Tests
run: python scripts/python/integration_test.py ./tables-test-fixtures/src/main/resources/dummy.token
- name: Stop Docker Containers
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml down
- name: Bump version and push tag
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true # prefix for tag "v"
DEFAULT_BUMP: patch # major, minor, patch
DRY_RUN: false # if true, will not push tag
INITIAL_VERSION: 0.5.0 # if no tags, will use this version
- name: Get the latest tag
id: get_tag
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
run: |
latest_tag=$(git describe --tags --abbrev=0 main)
semVer=${latest_tag:1} # Remove the first character ('v')
echo "semVer=${semVer}" >> "$GITHUB_OUTPUT"
- name: Publish with Gradle
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
env:
JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }}
JFROG_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
run: ./gradlew publish -Pversion=${{ steps.get_tag.outputs.semVer }}
- name: Login to LinkedIn Jfrog Docker artifactory
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
uses: docker/login-action@v3
with:
registry: linkedin-openhouse-docker.jfrog.io
username: ${{ secrets.JFROG_DOCKER_USERNAME }}
password: ${{ secrets.JFROG_DOCKER_PASSWORD }}
- name: Build and push Docker image for Tables Service
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
run: |
docker build -t linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/tables-service:${{ steps.get_tag.outputs.semVer }} -f tables-service.Dockerfile .
docker push linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/tables-service:${{ steps.get_tag.outputs.semVer }}
- name: Build and push Docker image for House Tables Service
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
run: |
docker build -t linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/housetables-service:${{ steps.get_tag.outputs.semVer }} -f housetables-service.Dockerfile .
docker push linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/housetables-service:${{ steps.get_tag.outputs.semVer }}
- name: Build and push Docker image for Jobs Service
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
run: |
docker build -t linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/jobs-service:${{ steps.get_tag.outputs.semVer }} -f jobs-service.Dockerfile .
docker push linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/jobs-service:${{ steps.get_tag.outputs.semVer }}
- name: Build and push Docker image for Jobs Scheduler
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
run: |
docker build -t linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/jobs-scheduler:${{ steps.get_tag.outputs.semVer }} -f jobs-scheduler.Dockerfile .
docker push linkedin-openhouse-docker.jfrog.io/linkedin/openhouse/jobs-scheduler:${{ steps.get_tag.outputs.semVer }}