Skip to content

Commit

Permalink
move to github
Browse files Browse the repository at this point in the history
* use github actions
* add APL 2.0 license
  • Loading branch information
schulzp committed Sep 15, 2020
1 parent 61bcae4 commit 54e6e53
Show file tree
Hide file tree
Showing 9 changed files with 525 additions and 108 deletions.
39 changes: 39 additions & 0 deletions .github/upload-github-release-asset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# Based on
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * repo
# * id
# * filename
#
# Script to upload a release asset using the GitHub API v3.
#
# Example:
#
# upload-github-release-asset.sh id=<release id> repo=<owner/repo> filename=<file>
#

# Check dependencies.
set -e
xargs=$(which gxargs || which xargs)

# Validate settings.
[ "$TRACE" ] && set -x

CONFIG=$@

for line in $CONFIG; do
eval "$line"
done

# Construct url
UPLOAD_URL="https://uploads.github.com/repos/$repo/releases/$id/assets?name=$(basename $filename)"

curl --data-binary @"$filename" -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/octet-stream" $UPLOAD_URL
90 changes: 90 additions & 0 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release

on:
push:
tags:
- v*

jobs:
github:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven Dependencies
if: always()
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: mvn-repository
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Maven Release
id: maven_release
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
GPG_KEYNAME: ${{ secrets.GPG_PRIVATE_KEY_NAME }}
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --no-tty --import
sed -i 's@<password>__GITHUB_TOKEN__.*$@<password>${{ secrets.GITHUB_TOKEN }}</password>@g' ${{ github.workspace }}/.mvn/settings.xml
mvn deploy --settings ${{ github.workspace }}/.mvn/settings.xml --batch-mode --no-transfer-progress -Prelease,gpg,github -Dmaven.wagon.http.pool=false
echo "##[set-output name=tag;]$(echo ${{ github.ref }} | sed 's@refs/tags/@@g')"
- name: GitHub Release
id: github_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.maven_release.outputs.tag }}
release_name: ${{ steps.maven_release.outputs.tag }}
body:
draft: false
prerelease: false
- name: GitHub Release Upload
id: github_release_upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: find . -name "*.jar" -exec .github/upload-github-release-asset.sh repo=${{ github.repository }} id=${{ steps.github_release.outputs.id }} filename={} ";"

bintray:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven Dependencies
if: always()
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: mvn-repository
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Maven Release
id: maven_release
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
GPG_KEYNAME: ${{ secrets.GPG_PRIVATE_KEY_NAME }}
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --no-tty --import
sed -i 's@<password>__BINTRAY_TOKEN__.*$@<password>${{ secrets.BINTRAY_TOKEN }}</password>@g' ${{ github.workspace }}/.mvn/settings.xml
mvn deploy --settings ${{ github.workspace }}/.mvn/settings.xml --batch-mode --no-transfer-progress -Prelease,gpg,bintray -Dmaven.wagon.http.pool=false
31 changes: 31 additions & 0 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Verify

on:
push:
tags-ignore:
- '*.*'
branches:
- master

jobs:
verify:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven Dependencies
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: mvn-repository
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build with Maven
run: mvn verify --settings ${{ github.workspace }}/.mvn/settings.xml --batch-mode --no-transfer-progress -Dmaven.wagon.http.pool=false
67 changes: 0 additions & 67 deletions .gitlab-ci.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>github</id>
<username>schulzp</username>
<password>__GITHUB_TOKEN__</password>
</server>
<server>
<id>bintray</id>
<username>schulzp</username>
<password>__BINTRAY_TOKEN__</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
<profile>
<id>github</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<altDeploymentRepository>github::https://maven.pkg.github.com/traum-ferienwohnungen/smallrye-metrics-async-timed</altDeploymentRepository>
</properties>
<repositories>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/traum-ferienwohnungen/smallrye-metrics-async-timed</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
<profile>
<id>bintray</id>
<properties>
<altDeploymentRepository>bintray::https://api.bintray.com/maven/traum-ferienwohnungen/maven/smallrye-metrics-async-timed/;publish=1</altDeploymentRepository>
</properties>
<repositories>
<repository>
<id>bintray</id>
<name>JFrog Bintray Apache Maven Packages</name>
<url>https://dl.bintray.com/traum-ferienwohnungen/maven</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
</settings>
Loading

0 comments on commit 54e6e53

Please sign in to comment.