Skip to content

Commit

Permalink
Merge branch 'master' into sho/docker
Browse files Browse the repository at this point in the history
  • Loading branch information
shocau authored Jun 25, 2024
2 parents b3efb91 + 7f28a2c commit d8939cc
Show file tree
Hide file tree
Showing 46 changed files with 810 additions and 649 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
strategy:
matrix:
java-version: [ 11 ]
node-version: [ 12.x ]
node-version: [ 20.x ]

steps:
# Checkout the repository of both elk and elkjs, place them next to each other.
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: elk-live
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: eclipse/elk-models
path: elk-live/elk-models
Expand All @@ -34,19 +34,20 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Cache npm
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json', '**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node-
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew
run: chmod +x $GITHUB_WORKSPACE/elk-live/server/gradlew
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Build client-side code
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: build-and-publish-docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: ["master"]

pull_request:
branches: ["master"]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Clean container registry
uses: actions/delete-package-versions@v5
with:
package-name: "elk-live"
package-type: "container"
min-versions-to-keep: 3
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit d8939cc

Please sign in to comment.