Skip to content

Commit

Permalink
Merge pull request #236 from wl-net/use-github-actions
Browse files Browse the repository at this point in the history
Use GitHub actions
  • Loading branch information
eanderso authored Aug 8, 2021
2 parents 02729cc + d551fb4 commit 35d188e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 10 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: run tests
run: ./gradlew test

build-and-push-image:
needs: tests
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: run build
run: ./gradlew jar
- name: run release
run: bash khakis/bin/release.sh
env:
REGISTRY_NAME: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
REGISTRY_SEPERATOR: '-'
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Tests
on: [push]
jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: run tests
run: ./gradlew test
2 changes: 1 addition & 1 deletion khakis/arcus-zookeeper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN \
rm -rf /var/lib/apt/lists/*

# Environment variables for configuration
ENV ZOOKEEPER_VERSION 3.6.2
ENV ZOOKEEPER_VERSION 3.6.3

# Download and install the required version of Apache Zookeeper.
RUN \
Expand Down
10 changes: 1 addition & 9 deletions khakis/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ set -e
ROOT=$(git rev-parse --show-toplevel)
GRADLE=$ROOT/gradlew

if [[ "${TRAVIS_REPO_SLUG}" != 'wl-net/arcusplatform' ]]; then
if [[ "${GITHUB_REPOSITORY}" != 'wl-net/arcusplatform' ]]; then
exit 0 # skip due to not being on a known repo
fi

if [ -z ${DOCKERHUB_USER+x} ]; then
export REGISTRY_NAME=docker.pkg.github.com/$TRAVIS_REPO_SLUG
echo "$GITHUB_SECRET" | docker login docker.pkg.github.com -u "$GITHUB_USERNAME" --password-stdin
else
export DOCKER_PREFIX_OVERRIDE=$DOCKERHUB_USER
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USER" --password-stdin
fi

echo "Building and publishing containers to '${REGISTRY_NAME}'"

$GRADLE :khakis:distDocker
Expand Down

0 comments on commit 35d188e

Please sign in to comment.