Merge branch 'stable' into dev #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish artifacts | |
on: | |
push: | |
branches: | |
- stable | |
- dev | |
workflow_dispatch: | |
env: | |
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
NEXUS_REPOSITORY: '' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | |
- name: Cache SonarQube packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Set Repository Environment Variable | |
run: | | |
if [ "${{ steps.extract_branch.outputs.branch }}" == "stable" ]; then | |
echo "NEXUS_REPOSITORY=${{ secrets.NEXUS_STABLE_REPOSITORY }}" >> $GITHUB_ENV | |
else | |
echo "NEXUS_REPOSITORY=${{ secrets.NEXUS_DEV_REPOSITORY }}" >> $GITHUB_ENV | |
fi | |
- name: Build and analyze | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
run: ./gradlew build sonar --info | |
- name: Publish package | |
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | |
with: | |
arguments: publish |