Skip to content

Commit

Permalink
Add build workflow and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Nov 10, 2023
1 parent bf22870 commit 1392ff2
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
push:
branches:
- '*'
tags:
- '*'

jobs:

build:

runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run build with Gradle Wrapper
run: ./gradlew build

- name: Upload war
uses: actions/upload-artifact@v3
with:
name: package
path: build/libs

- name: Log in to the Container registry
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
34 changes: 34 additions & 0 deletions sbdi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Ala-hub

## Setup

Create data directory at `/data/ala-hub` and populate as below (it is easiest to symlink the config files to the ones in this repo):
```
mats@xps-13:/data/ala-hub$ tree
.
└── config
├── ala-hub-config.properties -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/ala-hub-config.properties
├── charts.json -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/charts.json
└── grouped_facets_default.json -> /home/mats/src/biodiversitydata-se/ala-hub/sbdi/data/config/grouped_facets_default.json
```

## Usage

Run locally:
```
make run
```

Build and run in Docker (using Tomcat):
```
make run-docker
```

Make a release. This will create a new tag and push it. A new Docker container will be built on Github.
```
mats@xps-13:~/src/biodiversitydata-se/ala-hub (master *)$ make release
Current version: 1.0.1. Enter the new version (or press Enter for 1.0.2):
Updating to version 1.0.2
Tag 1.0.2 created and pushed.
```

0 comments on commit 1392ff2

Please sign in to comment.