Skip to content

BUILD-6050: Create release job step for GHA #18

BUILD-6050: Create release job step for GHA

BUILD-6050: Create release job step for GHA #18

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches: [ main ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
cache: 'gradle'
- name: Run tests
run: ./gradlew build && ./gradlew check
release:
name: Release version
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# if: github.ref == 'refs/heads/main'
needs:
- test
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
cache: 'gradle'
- name: Build Project
run: ./gradlew build
- name: Create Release
if: github.ref == 'refs/heads/main'
id: create_release
uses: zendesk/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
auto_increment_type: major
publish:
name: Publish version
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# if: github.ref == 'refs/heads/main'
needs:
- release
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
cache: 'gradle'
- name: Publish Package
# if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOYMENT_GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_GITHUB_TOKEN }}
run: |
make publish