Skip to content

Commit

Permalink
Updates to on-tag and update action versions
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilDigitalJustice committed Feb 6, 2025
1 parent d0df954 commit b6edd75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload jarfile
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: data-api-jar
path: data-service/build/libs/data-service-${{ steps.capture_version.outputs.app_version }}.jar
Expand All @@ -82,7 +82,7 @@ jobs:
- uses: actions/checkout@v3

- name: Download jar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: data-api-jar

Expand Down
34 changes: 12 additions & 22 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: echo "repo_name=caab-ebs${GITHUB_REPOSITORY#*\/laa-ccms-data}" >> $GITHUB_OUTPUT
id: extract_repo_name

build-test-publish:
assemble-publish:
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.capture_version.outputs.app_version }}
Expand All @@ -43,20 +43,10 @@ jobs:
- name: Build with Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
arguments: assemble
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: jacocoTestCoverageVerification

- name: Integration Test
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: integrationTest

- name: Publish package
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
Expand All @@ -73,13 +63,13 @@ jobs:
echo "Captured version: $VERSION"
- name: Upload jarfile
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: data-api-jar
path: data-service/build/libs/data-service-${{ steps.capture_version.outputs.app_version }}.jar

ecr:
needs: [ build-test-publish, define-image-tag ]
needs: [ assemble-publish, define-image-tag ]
runs-on: ubuntu-latest
permissions:
id-token: write # for requesting jwt
Expand All @@ -89,7 +79,7 @@ jobs:
- uses: actions/checkout@v3
# Assume role in cloud platform
- name: download jar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: data-api-jar

Expand All @@ -109,7 +99,7 @@ jobs:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ vars.ECR_REPOSITORY }}
REPO_NAME: ${{ needs.define-image-tag.outputs.repo_name }}
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
APP_VERSION: ${{ needs.assemble-publish.outputs.app_version }}
run: |
echo "Captured version: ${{ env.APP_VERSION }}"
docker build --build-arg app_version=${{ env.APP_VERSION }} -t $REGISTRY/$REPOSITORY:${{ env.REPO_NAME }}-${{ env.APP_VERSION }} .
Expand All @@ -121,7 +111,7 @@ jobs:
name: data-api-jar

update-helm-chart:
needs: [ build-test-publish, ecr, define-image-tag ]
needs: [ assemble-publish, ecr, define-image-tag ]
runs-on: ubuntu-latest
steps:
- name: Checkout charts repo
Expand All @@ -134,7 +124,7 @@ jobs:
- name: update helm chart
env:
REPO_NAME: ${{ needs.define-image-tag.outputs.repo_name }}
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
APP_VERSION: ${{ needs.assemble-publish.outputs.app_version }}
run: |
echo "${{ env.REPO_NAME }}-${{ env.APP_VERSION }}"
cd laa-ccms-caab-helm-charts/laa-ccms-caab-service/charts/caab-ebs-api/
Expand All @@ -146,7 +136,7 @@ jobs:
git push origin
update-laa-ccms-caab-ui:
needs: [ build-test-publish, define-image-tag ]
needs: [ assemble-publish, define-image-tag ]
runs-on: ubuntu-latest
steps:
- name: Checkout caab-ui repo
Expand All @@ -158,19 +148,19 @@ jobs:

- name: Create a new branch
env:
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
APP_VERSION: ${{ needs.assemble-publish.outputs.app_version }}
run: |
git checkout -b dependency/update-data-api-version-${APP_VERSION}
- name: Update gradle build file
env:
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
APP_VERSION: ${{ needs.assemble-publish.outputs.app_version }}
run: |
sed -i "s/uk.gov.laa.ccms.data:data-api:[^']*/uk.gov.laa.ccms.data:data-api:${APP_VERSION}/g" build.gradle
- name: Commit and push changes
env:
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
APP_VERSION: ${{ needs.assemble-publish.outputs.app_version }}
run: |
git config --global user.email "github@justice.gov.uk"
git config --global user.name "GitHub Actions Bot"
Expand Down

0 comments on commit b6edd75

Please sign in to comment.