Merge branch 'main' into harbor #11
This file contains hidden or 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: Release in Harbor | |
| on: | |
| push: | |
| branches: ["harbor"] | |
| env: | |
| REPOSITORY: ${{ vars.HARBOR_REPO }} # URL Harbor -> set in github variables | |
| IMAGE_NAME: billing-proxy | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| cache: maven | |
| - name: Set up Maven settings | |
| run: | | |
| cat > ~/.m2/settings.xml <<EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> | |
| <!--This sends everything else to /public --> | |
| <mirrors> | |
| <mirror> | |
| <id>nexus</id> | |
| <mirrorOf>external:*</mirrorOf> | |
| <url>${{ vars.NEXUS_URL }}/content/groups/alm-eng-esl-mirror/ | |
| </url> | |
| </mirror> | |
| </mirrors> | |
| <servers> | |
| <server> | |
| <id>almesl-snapshots</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| <server> | |
| <id>almesl-releases</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| <server> | |
| <id>nexus</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| </servers> | |
| <profiles> | |
| <profile> | |
| <id>nexus</id> | |
| <repositories> | |
| <repository> | |
| <id>almesl-snapshots</id> | |
| <url>${{ vars.NEXUS_URL }}/content/repositories/snapshots/ | |
| </url> | |
| <releases> | |
| <enabled>false</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>true</enabled> | |
| </snapshots> | |
| </repository> | |
| <repository> | |
| <id>almesl-releases</id> | |
| <url>${{ vars.NEXUS_URL }}/content/repositories/releases/ | |
| </url> | |
| <releases> | |
| <enabled>true</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>false</enabled> | |
| </snapshots> | |
| </repository> | |
| </repositories> | |
| <pluginRepositories> | |
| <pluginRepository> | |
| <id>nexus</id> | |
| <url>${{ vars.NEXUS_URL }}/content/groups/alm-eng-esl-mirror/</url> | |
| <releases> | |
| <enabled>true</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>true</enabled> | |
| </snapshots> | |
| </pluginRepository> | |
| </pluginRepositories> | |
| </profile> | |
| </profiles> | |
| <activeProfiles> | |
| <!--make the profile active all the time --> | |
| <activeProfile>nexus</activeProfile> | |
| </activeProfiles> | |
| </settings> | |
| EOF | |
| - name: Build with Maven | |
| run: mvn -B install --file pom.xml | |
| publish: | |
| name: Publish in Harbor | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| name: Set up JDK 17 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| cache: maven | |
| - name: Get Image Version | |
| run: | | |
| mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false -DinteractiveMode=false | |
| echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_OUTPUT" | |
| id: getVersion | |
| - name: Print Image Version | |
| run: | | |
| echo "The image version is ${{ steps.getVersion.outputs.version }}" | |
| - name: Set up Maven settings | |
| run: | | |
| cat > ~/.m2/settings.xml <<EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> | |
| <!--This sends everything else to /public --> | |
| <mirrors> | |
| <mirror> | |
| <id>nexus</id> | |
| <mirrorOf>external:*</mirrorOf> | |
| <url>${{ vars.NEXUS_URL }}/content/groups/alm-eng-esl-mirror/ | |
| </url> | |
| </mirror> | |
| </mirrors> | |
| <servers> | |
| <server> | |
| <id>almesl-snapshots</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| <server> | |
| <id>almesl-releases</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| <server> | |
| <id>nexus</id> | |
| <username>${{ vars.LDAP_USERNAME }}</username> | |
| <password>${{ secrets.LDAP_PASSWORD }}</password> | |
| </server> | |
| </servers> | |
| <profiles> | |
| <profile> | |
| <id>nexus</id> | |
| <repositories> | |
| <repository> | |
| <id>almesl-snapshots</id> | |
| <url>${{ vars.NEXUS_URL }}/content/repositories/snapshots/ | |
| </url> | |
| <releases> | |
| <enabled>false</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>true</enabled> | |
| </snapshots> | |
| </repository> | |
| <repository> | |
| <id>almesl-releases</id> | |
| <url>${{ vars.NEXUS_URL }}/content/repositories/releases/ | |
| </url> | |
| <releases> | |
| <enabled>true</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>false</enabled> | |
| </snapshots> | |
| </repository> | |
| </repositories> | |
| <pluginRepositories> | |
| <pluginRepository> | |
| <id>nexus</id> | |
| <url>${{ vars.NEXUS_URL }}/content/groups/alm-eng-esl-mirror/</url> | |
| <releases> | |
| <enabled>true</enabled> | |
| </releases> | |
| <snapshots> | |
| <enabled>true</enabled> | |
| </snapshots> | |
| </pluginRepository> | |
| </pluginRepositories> | |
| </profile> | |
| </profiles> | |
| <activeProfiles> | |
| <!--make the profile active all the time --> | |
| <activeProfile>nexus</activeProfile> | |
| </activeProfiles> | |
| </settings> | |
| EOF | |
| - name: Build Maven (skipTests) | |
| run: mvn -B package --file pom.xml -DskipTests | |
| - name: Login to Harbor | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REPOSITORY }} | |
| username: ${{ secrets.HARBOR_USERNAME_BILLING }} | |
| password: ${{ secrets.HARBOR_PASSWORD_BILLING }} | |
| - name: Build and Tag Image | |
| run: docker build -t ${{ env.REPOSITORY }}/dome/${{ env.IMAGE_NAME }}:${{ steps.getVersion.outputs.version }} . | |
| - name: Push Image to Harbor | |
| run: docker push ${{ env.REPOSITORY }}/dome/${{ env.IMAGE_NAME }}:${{ steps.getVersion.outputs.version }} | |
| - name: Remove Image | |
| run: docker rmi ${{ env.REPOSITORY }}/dome/${{ env.IMAGE_NAME }}:${{ steps.getVersion.outputs.version }} |