Skip to content

Commit

Permalink
refactor(ci): use reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mijailr committed Jan 22, 2024
1 parent 721af34 commit a0eaae7
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 122 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: docker-test
run-name: Docker test
on:
workflow_dispatch:
push:
branches:
- feature/public-registry
permissions:
packages: write
contents: read
jobs:
publish-docker:
uses: ./.github/workflows/publish-docker.yml
13 changes: 13 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: master
run-name: Merge on master branch
on:
workflow_dispatch:
push:
branches:
- master
permissions:
packages: write
contents: read
jobs:
publish-docker:
uses: ./.github/workflows/publish-docker.yml
129 changes: 129 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: publish-docker
run-name: Publish Docker Images
on:
workflow_call:
permissions:
packages: write
contents: read
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: 17

- name: Tests and Build
run: ./gradlew server:test server:shadowJar

- uses: actions/upload-artifact@v4
with:
name: server-jar
path: server/build/libs/server-*-all.jar

lh-server:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload Server Jar artifact
uses: actions/download-artifact@v4
with:
name: server-jar
path: server/build/libs/

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-server
dockerfile: docker/server/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

lhctl:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lhctl
dockerfile: docker/lhctl/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

dashboard-build:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Dashboard
working-directory: ./dashboard
run: |
npm install pnpm --global
pnpm install
pnpm build
- uses: actions/upload-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

lh-dashboard:
runs-on: ubuntu-latest
needs:
- dashboard-build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload NextJS artifact
uses: actions/download-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-dashboard
dockerfile: docker/dashboard/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

lh-standalone:
runs-on: ubuntu-latest
needs:
- dashboard-build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload NextJS artifact
uses: actions/download-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

- name: Dowload Server Jar artifact
uses: actions/download-artifact@v4
with:
name: server-jar
path: server/build/libs/

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-standalone
dockerfile: docker/standalone/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
123 changes: 2 additions & 121 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,8 @@ permissions:
packages: write
contents: read
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: 17

- name: Tests and Build
run: ./gradlew server:test server:shadowJar

- uses: actions/upload-artifact@v4
with:
name: server-jar
path: server/build/libs/server-*-all.jar
publish-docker:
uses: ./.github/workflows/publish-docker.yaml

sdk-java:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,106 +66,3 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ./sdk-python/dist/

lh-server:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload Server Jar artifact
uses: actions/download-artifact@v4
with:
name: server-jar
path: server/build/libs/

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-server
dockerfile: docker/server/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

lhctl:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lhctl
dockerfile: docker/lhctl/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

dashboard-build:
runs-on: ubuntu-latest
needs:
- build-server
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Dashboard
working-directory: ./dashboard
run: |
npm install pnpm --global
pnpm install
pnpm build
- uses: actions/upload-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

lh-dashboard:
runs-on: ubuntu-latest
needs:
- dashboard-build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload NextJS artifact
uses: actions/download-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-dashboard
dockerfile: docker/dashboard/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}

lh-standalone:
runs-on: ubuntu-latest
needs:
- dashboard-build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dowload NextJS artifact
uses: actions/download-artifact@v4
with:
name: nextjs
path: dashboard/apps/web/.next

- name: Dowload Server Jar artifact
uses: actions/download-artifact@v4
with:
name: server-jar
path: server/build/libs/

- name: Build and publish
uses: ./.github/actions/publish-image
with:
image-name: lh-standalone
dockerfile: docker/standalone/Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: main
name: tests
run-name: Tests
on:
workflow_dispatch:
Expand Down

0 comments on commit a0eaae7

Please sign in to comment.