Skip to content

Commit 5bc148e

Browse files
committed
Copied workflow on to java7 branch
1 parent 2a49b4a commit 5bc148e

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/java-ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This workflow will build a Java project with Ant
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
3+
4+
name: Java CI
5+
6+
on:
7+
push:
8+
branches: [ java7 ]
9+
pull_request:
10+
branches: [ java7 ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 1.8
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.8
23+
- name: Build with JCompilo
24+
run: ./jcompilo.sh

.github/workflows/release-tag.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release Tagged Builds
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 1.8
18+
- name: Set release version
19+
run: echo "::set-env name=RELEASE_VERSION::${GITHUB_REF##*/}"
20+
- name: Build with JCompilo
21+
run: BUILD_NUMBER="$RELEASE_VERSION" ./jcompilo.sh
22+
- name: Publish to Bintray
23+
run: bin/publish "$RELEASE_VERSION" "$BINTRAY_USERNAME" "$BINTRAY_PASSWORD"
24+
env:
25+
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
26+
BINTRAY_PASSWORD: ${{ secrets.BINTRAY_PASSWORD }}

bin/publish

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
print_usage_and_exit() {
7+
echo "Usage: $0 <build-version> <bintray api username> <bintray api key>" >&2
8+
exit 1
9+
}
10+
11+
main() {
12+
local ARTEFACT_NAME="totallylazy"
13+
local ORGANISATION_NAME="bodar"
14+
local REPOSITORY_NAME="maven"
15+
16+
local BUILD_VERSION=${1:-}
17+
local API_USERNAME=${2:-}
18+
local API_KEY=${3:-}
19+
[[ -z "$BUILD_VERSION" || -z "$API_USERNAME" || -z "$API_KEY" ]] && print_usage_and_exit
20+
21+
local BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
22+
local ARTEFACTS_DIR="$BASE_DIR/build/artifacts"
23+
24+
if [[ ! -d "$ARTEFACTS_DIR" ]]; then
25+
echo "Artefacts directory does not exist, please run the build: $ARTEFACTS_DIR" >&2
26+
exit 2
27+
fi
28+
29+
local POM_ARTEFACT="$ARTEFACTS_DIR/$ARTEFACT_NAME-$BUILD_VERSION.pom"
30+
if [[ ! -f "$POM_ARTEFACT" ]]; then
31+
echo "Cannot find POM artefact of expected form '$POM_ARTEFACT'" >&2
32+
exit 3
33+
fi
34+
35+
local GROUP_PATH=$(cat "$POM_ARTEFACT" | grep groupId | cut -f2 -d'>' | cut -f1 -d'<' | sed 's%\.%/%g')
36+
37+
for ARTEFACT_FILE in $ARTEFACTS_DIR/{*.jar,*.pom}; do
38+
local FILE_NAME=$(basename -- "$ARTEFACT_FILE")
39+
echo "Publishing $FILE_NAME... "
40+
curl -T "$ARTEFACT_FILE" "-u$API_USERNAME:$API_KEY" "https://api.bintray.com/content/$ORGANISATION_NAME/$REPOSITORY_NAME/$ARTEFACT_NAME/$BUILD_VERSION/$GROUP_PATH/$ARTEFACT_NAME/$BUILD_VERSION/$FILE_NAME;publish=1"
41+
echo ""
42+
done
43+
}
44+
45+
main "$@"

0 commit comments

Comments
 (0)