Skip to content

Commit

Permalink
Use gradle templates (#35)
Browse files Browse the repository at this point in the history
* Switch to build/release gradle templates
* Bump template version to v2.1.2
  • Loading branch information
octopusden committed Jun 7, 2023
1 parent dd56f65 commit d763f49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Gradle Compile & UT

on: [push, pull_request, workflow_dispatch]

jobs:
run-build-and-deploy:
uses: octopusden/octopus-base/.github/workflows/[email protected]
with:
flow-type: hybrid
java-version: '11'
docker-image: employee-service
56 changes: 10 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,16 @@
name: Release
name: Gradle Release

on:
repository_dispatch:
types: [ release ]
types: release

jobs:
build:
runs-on: ubuntu-latest
environment: Prod
steps:
- uses: actions/checkout@v3
name: Checkout(switching to commit)
with:
ref: ${{ github.event.client_payload.commit }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: GitHub Tag Name
run: |
echo "Current version: ${{ github.event.client_payload.project_version }}"
- name: Build with Gradle
run: ./gradlew build dockerBuildImage -x test -Poctopus.github.docker.registry=ghcr.io -Pdocker.registry=docker.io -Pversion=${{ github.event.client_payload.project_version }} --info
env:
BUILD_VERSION: ${{ github.event.client_payload.project_version }}
- name: Publish
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Pversion=${{ github.event.client_payload.project_version }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
BUILD_VERSION: ${{ github.event.client_payload.project_version }}
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to docker registry
run: docker push ghcr.io/octopusden/employee-service:${{ github.event.client_payload.project_version }}
- name: Create Release
uses: marvinpinto/action-automatic-releases@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
automatic_release_tag: v${{ github.event.client_payload.project_version }}
uses: octopusden/octopus-base/.github/workflows/[email protected]
with:
flow-type: hybrid
java-version: '11'
commit-hash: ${{ github.event.client_payload.commit }}
build-version: ${{ github.event.client_payload.project_version }}
docker-image: employee-service
secrets: inherit

0 comments on commit d763f49

Please sign in to comment.