[artifact-manager,vra-ng] (#207) Remove regional content support from vra-ng
projects
#2679
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 Project | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" # trigger the workflow for main branch | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java: ["17","21"] | |
maven: ["3.9.2"] | |
node: ["16.20.2"] | |
node_vmware_samples: ["14.17.1"] | |
os: ["ubuntu-latest"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout vmware/build-tools-for-vmware-aria repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Setup Maven Action | |
uses: s4u/[email protected] | |
with: | |
java-version: ${{ matrix.java }} | |
java-distribution: "temurin" | |
maven-version: ${{ matrix.maven }} | |
- name: Install xmllint | |
run: sudo apt-get install libxml2-utils | |
- name: Install [email protected] | |
run: npm install -g [email protected] | |
- name: Print versions | |
run: | | |
echo "-------------------------------------------" | |
echo "-----------< TOOLS AND VERSIONS >----------" | |
git --version | |
java -version 2>&1 | |
mvn --version | |
echo "node version: $(node --version)" | |
echo "npm version: $(npm --version)" | |
pip3 --version | |
python --version | |
pwsh --version | |
gpg --version | head -n 1 | |
openssl version | |
xmllint --version 2>&1 | head -n 1 | |
echo "Installed global npm packages:" | |
npm list -g --depth=0 | |
echo "-------------------------------------------" | |
echo "-------------------------------------------" | |
- name: Get IAC version | |
run: echo "IAC_VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Replace variables in settings.xml | |
run: | | |
sed -i "s/{{ IAC_VERSION }}/${{ env.IAC_VERSION }}/g" .m2/settings.xml | |
sed -i "s/{{ OSSRH_USERNAME }}/${{ secrets.OSSRH_USERNAME }}/g" .m2/settings.xml | |
sed -i "s/{{ OSSRH_PASSWORD }}/${{ secrets.OSSRH_PASSWORD }}/g" .m2/settings.xml | |
- name: Import GPG Key | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Set default env GPG_PASSPHRASE | |
run: echo "GPG_PASSPHRASE=''" >> $GITHUB_ENV | |
- name: Set env GPG_PASSPHRASE if main | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: echo "GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}" >> $GITHUB_ENV | |
- name: Set MVN_BUILD_COMMAND | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ matrix.java }}" = "17" ]; then | |
MVN_BUILD_COMMAND="install deploy" | |
else | |
MVN_BUILD_COMMAND="install" | |
fi | |
echo "MVN_BUILD_COMMAND is $MVN_BUILD_COMMAND" | |
echo "MVN_BUILD_COMMAND=$MVN_BUILD_COMMAND" >> $GITHUB_ENV | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build 'iac' - parent IAC project ONLY | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml -pl . | |
- name: Build 'keystore-example' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f common/keystore-example/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'npmlib' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f maven/npmlib/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'iac' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'base-package' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f maven/base-package/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'packages' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f packages/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'typescript-project-all' | |
run: mvn clean ${{ env.MVN_BUILD_COMMAND }} -f maven/typescript-project-all/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Build 'repository' | |
if: ${{ matrix.java == 17 }} | |
run: mvn clean package -f maven/repository/pom.xml --batch-mode -Dgpg.passphrase=${{ env.GPG_PASSPHRASE }} -s $PWD/.m2/settings.xml | |
- name: Checkout vmware-samples/build-tools-for-vmware-aria-samples repository | |
uses: actions/checkout@v3 | |
with: | |
repository: vmware-samples/build-tools-for-vmware-aria-samples | |
ref: main | |
path: build-tools-for-vmware-aria-samples | |
- name: Use Node.js ${{ matrix.node_vmware_samples }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_vmware_samples }} | |
- name: Build vmware-samples/build-tools-for-vmware-aria-samples project repository | |
run: | | |
pushd build-tools-for-vmware-aria-samples/ | |
./switch_parent_version.sh ${{ env.IAC_VERSION }} | |
mvn clean package install -Pbundle-with-installer --batch-mode -s ../.m2/settings.xml | |
popd | |
rm -rf build-tools-for-vmware-aria-samples/ | |
- name: Set artifact file name | |
if: ${{ !contains(env.IAC_VERSION, '-SNAPSHOT') && matrix.java == 17 }} | |
run: echo "ARTIFACT_FILE_NAME=build-tools-for-vmware-aria-${{ env.IAC_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Package all artifacts | |
if: ${{ !contains(env.IAC_VERSION, '-SNAPSHOT') && matrix.java == 17 }} | |
run: | | |
cp maven/repository/target/iac-maven-repository.zip . | |
tar -zcvf "${{ env.ARTIFACT_FILE_NAME }}.zip" iac-maven-repository.zip docs/ "LICENSE.txt" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ !contains(env.IAC_VERSION, '-SNAPSHOT') && matrix.java == 17 }} | |
with: | |
name: ${{ env.ARTIFACT_FILE_NAME }} | |
path: ${{ env.ARTIFACT_FILE_NAME }}.zip | |
results: | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
name: Build Results | |
needs: [build] | |
steps: | |
- run: exit 1 | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') | |
|| contains(needs.*.result, 'cancelled') | |
}} |