Skip to content

Commit

Permalink
build(lapis2): use Release Please to generate releases
Browse files Browse the repository at this point in the history
resolves #678
  • Loading branch information
fengelniederhammer committed May 7, 2024
1 parent 91ecfbd commit c05f7e0
Show file tree
Hide file tree
Showing 9 changed files with 1,867 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lapis2-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run: npm run check-types

dockerImage:
name: Build Docker Image And Run E2E Tests
name: Build Docs Docker Image And Run E2E Tests
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/release-lapis2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release LAPIS 2

on:
workflow_run:
workflows: [LAPIS v2]
types: [completed]
branches: [main]

env:
LAPIS_DOCKER_IMAGE_NAME: ghcr.io/genspectrum/lapis-v2
DOCS_DOCKER_IMAGE_NAME: ghcr.io/genspectrum/lapis-v2-docs

jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
packages: write
checks: read
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'GenSpectrum/LAPIS' }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
path: .
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
include-component-in-tag: true
target-branch: main

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- name: Set up Docker Buildx
if: ${{ steps.release.outputs.release_created }}
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Wait for Lapis 2 Docs Docker Image
if: ${{ steps.release.outputs.release_created }}
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.sha }}
check-name: Build Docs Docker Image And Run E2E Tests
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Tag Already Built Images With Release Tags
if: ${{ steps.release.outputs.release_created }}
run: |
MAJOR=${{ steps.release.outputs.major }}
MINOR=${{ steps.release.outputs.minor }}
PATCH=${{ steps.release.outputs.patch }}
TAGS=("$MAJOR.$MINOR" "$MAJOR.$MINOR.$PATCH")
# TODO (#777) include $MAJOR only for releases >= 1.0
# TAGS=("$MAJOR" "$MAJOR.$MINOR" "$MAJOR.$MINOR.$PATCH") - don't include major-only for pre-1.0
IMAGES=("${{ env.LAPIS_DOCKER_IMAGE_NAME }}" "${{ env.DOCS_DOCKER_IMAGE_NAME }}")
for IMAGE in "${IMAGES[@]}"; do
for TAG in "${TAGS[@]}"; do
docker buildx imagetools create --tag $IMAGE:$TAG $IMAGE:latest
done
done
4 changes: 4 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"lapis2": "0.0.1",
"lapis2-docs": "0.0.1"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Lightweight API for Sequences (LAPIS)

The documentaion is available at https://lapis-docs.readthedocs.io/.
We are currently developing LAPIS 2.
Refer to the [README](lapis2/README.md) in the `lapis2` directory for more information.

The documentation of the old version is available at https://lapis-docs.readthedocs.io/.
15 changes: 15 additions & 0 deletions lapis2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@ How to execute the tests

LAPIS logs to rotating files in `./logs` and to stdout.
In the Docker container, log files are stored in `/workspace/logs`

## Creating A Release

This project uses [Release Please](https://github.com/google-github-actions/release-please-action) to generate releases.
On every commit on the `main` branch, it will update a Pull Request with a changelog.
When the PR is merged, the release will be created.
Creating a release means:

* A new Git tag is created.
* The Docker images of lapis2 and lapis2-docs are tagged with the new version.
* Suppose the created version is `2.4.5`, then it creates the tags `2`, `2.4` and `2.4.5`.

The changelog and the version number are determined by the commit messages.
Therefore, commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
Also refer to the Release Please documentation for more information on how to write commit messages.
2 changes: 1 addition & 1 deletion lapis2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = 'org.genspectrum'
version = '0.0.1-SNAPSHOT'
version = '0.0.1' // x-release-please-version - this is a marker comment for Release Please to update this version

java {
sourceCompatibility = '21'
Expand Down
Loading

0 comments on commit c05f7e0

Please sign in to comment.