-
Notifications
You must be signed in to change notification settings - Fork 177
GitHub actions #1101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub actions #1101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Build and Push Content Service Image | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # Step 1: Checkout the code | ||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| # Step 2: Set up JDK 11 and Maven | ||
| - name: Set up JDK 11 and Maven | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '11' | ||
| cache: 'maven' | ||
|
|
||
| # Step 3: Build the project | ||
| - name: Build Content Service | ||
| run: | | ||
| mvn clean install -DskipTests=true \ | ||
| -DCLOUD_STORE_GROUP_ID=${{ vars.CLOUD_STORE_GROUP_ID }} \ | ||
| -DCLOUD_STORE_ARTIFACT_ID=${{ vars.CLOUD_STORE_ARTIFACT_ID }} \ | ||
| -DCLOUD_STORE_VERSION=${{ vars.CLOUD_STORE_VERSION }} | ||
|
|
||
| # Step 4: Package the project | ||
| - name: Package Content Service | ||
| run: | | ||
| cd content-api | ||
| mvn play2:dist -pl content-service \ | ||
| -DCLOUD_STORE_GROUP_ID=${{ vars.CLOUD_STORE_GROUP_ID }} \ | ||
| -DCLOUD_STORE_ARTIFACT_ID=${{ vars.CLOUD_STORE_ARTIFACT_ID }} \ | ||
| -DCLOUD_STORE_VERSION=${{ vars.CLOUD_STORE_VERSION }} | ||
|
|
||
| # Step 5: Set up Login to Docker registry | ||
| - name: Determine registry and login | ||
| run: | | ||
| if [[ -n "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" ]]; then | ||
| echo "Using Google Container Registry" | ||
| echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 --decode > $HOME/gcloud-key.json | ||
| gcloud auth activate-service-account --key-file=$HOME/gcloud-key.json | ||
| gcloud auth configure-docker ${{ secrets.REGISTRY_NAME }} | ||
| REGISTRY_URL=$(echo "${{ secrets.REGISTRY_URL }}" | tr '[:upper:]' '[:lower:]') | ||
|
|
||
| elif [[ -n "${{ secrets.REGISTRY_USERNAME }}" && -n "${{ secrets.REGISTRY_PASSWORD }}" ]]; then | ||
| echo "Logging in to custom Docker registry" | ||
| echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_NAME }} \ | ||
| --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin | ||
| REGISTRY_URL=$(echo "${{ secrets.REGISTRY_URL }}" | tr '[:upper:]' '[:lower:]') | ||
|
|
||
| else | ||
| echo "Using GitHub Container Registry (GHCR)" | ||
| REPO_NAME_LOWERCASE=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]') | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
| REGISTRY_URL="ghcr.io/$REPO_NAME_LOWERCASE" | ||
| fi | ||
|
|
||
| echo "REGISTRY_URL=${REGISTRY_URL}" >> $GITHUB_ENV | ||
|
|
||
| # Step 6: Build Docker image | ||
| - name: Build Docker Image | ||
| run: | | ||
| IMAGE_NAME="content-service" | ||
| IMAGE_TAG=$(echo "${{ github.ref_name }}_$(echo $GITHUB_SHA | cut -c1-7)" | tr '[:upper:]' '[:lower:]') | ||
| docker build -f build/content-service/Dockerfile -t $REGISTRY_URL/${IMAGE_NAME}:${IMAGE_TAG} . | ||
|
|
||
| echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV | ||
| echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | ||
|
|
||
| - name: Push Docker Image | ||
| run: | | ||
| docker push $REGISTRY_URL/${IMAGE_NAME}:${IMAGE_TAG} | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||
| name: Build and Push Search Service Image | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| tags: | ||||||
| - '*' | ||||||
|
|
||||||
| jobs: | ||||||
| build-and-push: | ||||||
| runs-on: ubuntu-latest | ||||||
|
|
||||||
| steps: | ||||||
| # Step 1: Checkout the code | ||||||
| - name: Checkout code | ||||||
| uses: actions/checkout@v2 | ||||||
|
|
||||||
| # Step 2: Set up JDK 11 and Maven | ||||||
| - name: Set up JDK 11 and Maven | ||||||
| uses: actions/setup-java@v3 | ||||||
| with: | ||||||
| distribution: 'temurin' | ||||||
| java-version: '11' | ||||||
| cache: 'maven' | ||||||
|
|
||||||
| # Step 4: Build the project | ||||||
| - name: Build Search API Service | ||||||
| run: | | ||||||
| mvn clean install -DskipTests=true \ | ||||||
| -DCLOUD_STORE_GROUP_ID=${{ vars.CLOUD_STORE_GROUP_ID }} \ | ||||||
| -DCLOUD_STORE_ARTIFACT_ID=${{ vars.CLOUD_STORE_ARTIFACT_ID }} \ | ||||||
| -DCLOUD_STORE_VERSION=${{ vars.CLOUD_STORE_VERSION }} | ||||||
|
|
||||||
| # Step 5: Package the project | ||||||
| - name: Package Search API Service | ||||||
| run: | | ||||||
| cd search-api | ||||||
|
||||||
| cd search-api | |
| cd search-service |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||
| name: Build and Push Taxonomy Service Image | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| tags: | ||||||
| - '*' | ||||||
|
|
||||||
| jobs: | ||||||
| build-and-push: | ||||||
| runs-on: ubuntu-latest | ||||||
|
|
||||||
| steps: | ||||||
| # Step 1: Checkout the code | ||||||
| - name: Checkout code | ||||||
| uses: actions/checkout@v2 | ||||||
|
|
||||||
| # Step 2: Set up JDK 11 and Maven | ||||||
| - name: Set up JDK 11 and Maven | ||||||
| uses: actions/setup-java@v3 | ||||||
| with: | ||||||
| distribution: 'temurin' | ||||||
| java-version: '11' | ||||||
| cache: 'maven' | ||||||
|
|
||||||
| # Step 4: Build the project | ||||||
| - name: Build Taxonomy API Service | ||||||
| run: | | ||||||
| mvn clean install -DskipTests=true \ | ||||||
| -DCLOUD_STORE_GROUP_ID=${{ vars.CLOUD_STORE_GROUP_ID }} \ | ||||||
| -DCLOUD_STORE_ARTIFACT_ID=${{ vars.CLOUD_STORE_ARTIFACT_ID }} \ | ||||||
| -DCLOUD_STORE_VERSION=${{ vars.CLOUD_STORE_VERSION }} | ||||||
|
|
||||||
| # Step 5: Package the project | ||||||
| - name: Package Taxonomy API Service | ||||||
| run: | | ||||||
| cd taxonomy-api | ||||||
|
||||||
| cd taxonomy-api | |
| cd taxonomy-service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The directory name 'content-api' differs from the packaging target 'content-service'; aligning these names may improve maintainability.