java-webapp-gha #93
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: java-webapp-gha | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ "main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
JF_ENV_1: ${{ secrets.JF_SECRET }} | |
JF_ID: yann-sbx | |
JF_CLI_VERSION: 2.27.1 | |
APP_VERSION: 2.0.0 | |
MVN_REPO: urs-mvn | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build_webapp: | |
if: ${{ true }} | |
runs-on: ubuntu-latest | |
env: | |
JF_ENV_1: ${{ secrets.JF_SECRET }} | |
JFROG_BUILD_STATUS: PASS | |
JAVA_VERSION: 16.0.2+7 | |
JAVA_DIST: zulu | |
MVN_VERSION: 3.8.2 | |
# required by jf CLI | |
# M2_HOME: /opt/hostedtoolcache/maven/3.8.2/x64 # NOT required in jf CLI v2.3.0 | |
MVN_REPO: yann-maven-test | |
PROMOTE_REPO: urs-mvn-release-local | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup JFrog CLI | |
uses: jfrog/setup-jfrog-cli@v3 | |
env: | |
JF_URL: ${{ secrets.JF_YANN_SBX }} | |
with: | |
version: ${{ env.JF_CLI_VERSION }} | |
oidc-provider-name: yann-oidc | |
oidc-audience: java-dev | |
- name: Setup Java JDK ${{ env.JAVA_DIST }} ${{ env.JAVA_VERSION }} | |
uses: actions/[email protected] | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DIST }} | |
- name: Setup Maven ${{ env.MVN_VERSION }} | |
uses: stCarolas/[email protected] | |
with: | |
maven-version: ${{ env.MVN_VERSION }} | |
- name: Ping Artifactory | |
run: | | |
jf --version | |
jf config show | |
jf rt ping | |
env | |
- name: Configure JFrog CLI with Maven client | |
run: | | |
jf rt mvnc \ | |
--server-id-resolve=${{ env.JF_ID }} \ | |
--repo-resolve-releases=${{ env.MVN_REPO }} \ | |
--repo-resolve-snapshots=${{ env.MVN_REPO }} \ | |
--server-id-deploy=${{ env.JF_ID }} \ | |
--repo-deploy-releases=${{ env.MVN_REPO }} \ | |
--repo-deploy-snapshots=${{ env.MVN_REPO }} | |
# - name: Scan dependencies | |
# run: cd src && jf audit | |
- name: Build webapp and scan generated artifact before upload | |
run: jf mvn clean install -f src/ --no-transfer-progress | |
- name: Publish Build Info | |
run: | | |
# Collect environment variables for the build | |
jf rt bce | |
# Collect VCS details from git and add them to the build | |
jf rt bag | |
# Publish build info | |
jf rt bp | |
- name: Run test | |
run: echo running tests ... | |
- name: Promote Build | |
run: jf rt bpr --fail-fast=false --status "TEST_OK" --comment "promoted to the next level" ${{ env.PROMOTE_REPO }} | |