Skip to content

Commit

Permalink
Publish workflow with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SpOOnman committed Jan 13, 2021
1 parent 976f16a commit 4d9cc62
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 24 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/publish.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release
on:
push:
tags:
- 'sputnik*'

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Extract version
run: echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/tags/sputnik-})"
id: extract_version
- name: Build project
run: ./gradlew -Pversion=${{ steps.extract_version.outputs.version }} build
- name: Publish package
run: ./gradlew -Pversion=${{ steps.extract_version.outputs.version }} publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Sputnik ${{ steps.extract_version.outputs.version }}
draft: true
prerelease: false
- name: Upload jar
id: upload-release-asset-jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/sputnik-${{ steps.extract_version.outputs.version }}.jar
asset_name: sputnik-${{ steps.extract_version.outputs.version }}.jar
asset_content_type: application/java-archive
- name: Upload javadoc
id: upload-release-asset-javadoc
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/sputnik-${{ steps.extract_version.outputs.version }}-javadoc.jar
asset_name: sputnik-${{ steps.extract_version.outputs.version }}-javadoc.jar
asset_content_type: application/java-archive
- name: Upload sources
id: upload-release-asset-sources
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/sputnik-${{ steps.extract_version.outputs.version }}-sources.jar
asset_name: sputnik-${{ steps.extract_version.outputs.version }}-sources.jar
asset_content_type: application/java-archive
- name: Upload zip
id: upload-release-asset-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/distributions/sputnik-${{ steps.extract_version.outputs.version }}.zip
asset_name: sputnik-${{ steps.extract_version.outputs.version }}.zip
asset_content_type: application/zip
- name: Upload tar
id: upload-release-asset-tar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/distributions/sputnik-${{ steps.extract_version.outputs.version }}.tar
asset_name: sputnik-${{ steps.extract_version.outputs.version }}.tar
asset_content_type: application/tar
32 changes: 28 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ configurations {
}
}

project.version = '2.3.1.1' //scmVersion.version
project.version = findProperty("version") ?: scmVersion.version

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -218,6 +218,32 @@ publishing {
distribution = 'repo'
}
}
developers {
developer {
id = 'tomasz_kalkosinski'
name = 'Tomasz Kalkosinski'
}
developer {
id = 'marcin_cylke'
name = 'Marcin Cylke'
}
developer {
id = 'piotr_jagielski'
name = 'Piotr Jagielski'
}
developer {
id = 'karol_lassak'
name = 'Karol Lassak'
}
developer {
id = 'dominik_przybysz'
name = 'Dominik Przybysz'
}
developer {
id = 'henning_hoefer'
name = 'Henning Hoefer'
}
}
}
}
}
Expand All @@ -234,8 +260,6 @@ publishing {
}

signing {
def signingKey = System.getenv('SIGNING_KEY')
def signingPassword = System.getenv('SIGNING_PASSWORD')
useInMemoryPgpKeys(signingKey, signingPassword)
useInMemoryPgpKeys(System.getenv('SIGNING_PRIVATE_KEY'), System.getenv('SIGNING_PASSWORD'))
sign publishing.publications.mavenJava
}

0 comments on commit 4d9cc62

Please sign in to comment.