Skip to content

Commit

Permalink
New and better build script
Browse files Browse the repository at this point in the history
  • Loading branch information
eivinhb committed Dec 18, 2020
1 parent c010481 commit c6b1682
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 32 deletions.
52 changes: 41 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Build snapshot
name: Build and deploy

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
java: [ '1.8', '11' ]
Expand All @@ -21,17 +19,49 @@ jobs:
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml

deploy:
makeversion:
if: github.ref != 'refs/heads/main'
needs: build
runs-on: ubuntu-latest

name: deploy snapshot
name: Create version
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Decide on build version
id: version
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
echo ::set-output name=version::${TAG//\//-}
deploy_snapshot:
if: startsWith(github.ref, 'refs/heads/')
needs: makeversion
runs-on: ubuntu-latest

name: Deploy snapshot
steps:
- uses: actions/checkout@v1
- name: Set release version
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}"-SNAPSHOT")
- name: Build and deploy to Sonatype snapshot
uses: digipost/[email protected]
- uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ env.RELEASE_VERSION }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: false

release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: makeversion
name: Release to Sonatype
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Release to Central Repository
uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: true
21 changes: 0 additions & 21 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit c6b1682

Please sign in to comment.