Merge pull request #13 from WorldHealthOrganization/fix/pipeline #30
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: ci-main | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
- name: version | |
run: >- | |
APP_SHA=$(git rev-parse --short ${GITHUB_SHA}); | |
APP_REV=$(git rev-list --tags --max-count=1); | |
APP_TAG=$(git describe --tags ${APP_REV} 2> /dev/null || echo 0.0.0); | |
APP_VERSION=${APP_TAG}-${APP_SHA}; | |
echo "APP_SHA=${APP_SHA}" >> ${GITHUB_ENV}; | |
echo "APP_TAG=${APP_TAG}" >> ${GITHUB_ENV}; | |
echo "APP_VERSION=${APP_VERSION}" >> ${GITHUB_ENV}; | |
- name: mvn | |
run: >- | |
mvn versions:set | |
--batch-mode | |
--file ./pom.xml | |
--settings ./settings.xml | |
--define newVersion="${APP_VERSION}"; | |
mvn clean deploy | |
--batch-mode | |
--file ./pom.xml | |
--settings ./settings.xml | |
--define app.packages.username="${APP_PACKAGES_USERNAME}" | |
--define app.packages.password="${APP_PACKAGES_PASSWORD}"; | |
env: | |
APP_PACKAGES_USERNAME: ${{ github.actor }} | |
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
license: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GPR_TOKEN_F11H }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
- name: mvn | |
run: >- | |
mvn license:update-file-header license:add-third-party | |
--batch-mode | |
--file ./pom.xml | |
--settings ./settings.xml | |
--define app.packages.username="${APP_PACKAGES_USERNAME}" | |
--define app.packages.password="${APP_PACKAGES_PASSWORD}"; | |
env: | |
APP_PACKAGES_USERNAME: ${{ github.actor }} | |
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit and Push changes | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git diff --quiet && git diff --staged --quiet || git commit -m "Update License Header and Third Party Notices" | |
git push |