-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub workflow for release (#141)
* added release.yml copied from Planetiler * added build-release.sh copied from Planetiler * release job adjusted for planetiler-openmaptiles * fixed path to target/*with-deps.jar * GPG private key skip[ped, since we're not going to publish to maven central * removed -Pflatten, since (unlike planetiler) this is not multi-module repo * removed settings for pushing to maven central, we're not doing that here * push-release.sh replaced with Docker push and artifact upload (line in snapshot.yml)
- Loading branch information
1 parent
461ea67
commit 6d238c7
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Publish a Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version without leading "v" (1.0, 2.3.4, 0.1.0-pre1)' | ||
required: true | ||
default: '' | ||
image_tags: | ||
description: 'Extra docker image tags ("latest,test")' | ||
required: true | ||
default: 'latest,release' | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Ensure version does not start with 'v' | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ github.token }} | ||
script: | | ||
version = context.payload.inputs.version; | ||
if (/^v/.test(version)) throw new Error("Bad version number: " + version) | ||
- uses: actions/checkout@v4 | ||
- name: Cache data/sources | ||
uses: ./.github/cache-sources-action | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
|
||
- name: Check tag does not exist yet | ||
run: if git rev-list "v${{ github.event.inputs.version }}"; then echo "Tag already exists. Aborting the release process."; exit 1; fi | ||
|
||
- run: ./scripts/set-versions.sh "${{ github.event.inputs.version }}" | ||
- run: ./scripts/build-release.sh | ||
- run: ./scripts/test-release.sh "${{ github.event.inputs.version }}" | ||
- name: Create tag | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ github.token }} | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/v${{ github.event.inputs.version }}", | ||
sha: context.sha | ||
}) | ||
- run: mv target/*with-deps.jar planetiler-openmaptiles.jar | ||
- run: sha256sum planetiler-openmaptiles.jar > planetiler-openmaptiles.jar.sha256 | ||
- run: md5sum planetiler-openmaptiles.jar > planetiler-openmaptiles.jar.md5 | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
fail_on_unmatched_files: true | ||
tag_name: v${{ github.event.inputs.version }} | ||
draft: true | ||
files: | | ||
planetiler-openmaptiles.jar* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: 'Build and push to dockerhub' | ||
run: ./mvnw -B -ntp -Pjib-multi-arch -Djib.to.tags="latest" package jib:build --file pom.xml | ||
- run: sha256sum target/*with-deps.jar | ||
- run: md5sum target/*with-deps.jar | ||
- name: 'Upload artifact' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: planetiler-build | ||
path: target/*with-deps.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
./mvnw -B -ntp install jib:dockerBuild |