Skip to content
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

Task/ccls 1880 amend package versions #57

Merged
merged 54 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3f0fcd5
update
PhilDigitalJustice Oct 17, 2023
2fc2fdf
update
PhilDigitalJustice Oct 17, 2023
8158d71
Update test.yml
PhilDigitalJustice Oct 17, 2023
a4b791d
Update test.yml
PhilDigitalJustice Oct 17, 2023
c899171
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-data-api-0.0.1'.
Oct 17, 2023
de09c8d
[Gradle Release Plugin] - new version commit: 'laa-ccms-data-api-0.0…
Oct 17, 2023
e7447f6
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-data-api-0.0.2'.
Oct 17, 2023
8d10481
Revert " [Gradle Release Plugin] - pre tag commit: 'laa-ccms-data-ap…
PhilDigitalJustice Oct 17, 2023
35f31f4
Update settings.gradle
PhilDigitalJustice Oct 17, 2023
22c55ce
Update gradle.properties
PhilDigitalJustice Oct 17, 2023
7879f30
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 17, 2023
c7c5d0f
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 17, 2023
68275fb
testing
PhilDigitalJustice Oct 17, 2023
843f64f
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 17, 2023
4f21856
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 17, 2023
f403199
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 17, 2023
7f342d5
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 17, 2023
c331e51
Merge branch 'task/ccls-1880_amend_package_versions' of https://githu…
PhilDigitalJustice Oct 17, 2023
d8839f6
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
PhilDigitalJustice Oct 17, 2023
a9f9568
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
PhilDigitalJustice Oct 17, 2023
4cb4215
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 17, 2023
ac0f4b2
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 17, 2023
fad516c
test
PhilDigitalJustice Oct 17, 2023
2a6691d
Update push-branch-test.yml
PhilDigitalJustice Oct 17, 2023
8597f13
Update push-branch-test.yml
PhilDigitalJustice Oct 17, 2023
ba48565
Update push-branch-test.yml
PhilDigitalJustice Oct 17, 2023
8cc03d8
Update push-branch-test.yml
PhilDigitalJustice Oct 17, 2023
1cf329d
Update build.gradle
PhilDigitalJustice Oct 17, 2023
d9f6f9c
fix
PhilDigitalJustice Oct 17, 2023
9c49598
Update Dockerfile
PhilDigitalJustice Oct 17, 2023
1059ea1
updates
PhilDigitalJustice Oct 18, 2023
bcb548f
update
PhilDigitalJustice Oct 18, 2023
4769426
Update push-branch-main.yml
PhilDigitalJustice Oct 18, 2023
ccf6307
Update push-branch-main.yml
PhilDigitalJustice Oct 18, 2023
674ec20
updates
PhilDigitalJustice Oct 18, 2023
6348704
Update gradle.properties (#54)
PhilDigitalJustice Oct 18, 2023
c8605be
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 18, 2023
79f9edc
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 18, 2023
fb12786
updates
PhilDigitalJustice Oct 18, 2023
4d3c9fd
rename files
PhilDigitalJustice Oct 18, 2023
595e8ef
Update gradle.properties (#55)
PhilDigitalJustice Oct 18, 2023
134a2ff
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 18, 2023
f8151fb
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 18, 2023
188e004
test
PhilDigitalJustice Oct 18, 2023
01e7d23
Update push-branch-test.yml
PhilDigitalJustice Oct 18, 2023
902d797
Update push-branch-test.yml
PhilDigitalJustice Oct 18, 2023
67b2c5d
Raise PR
PhilDigitalJustice Oct 18, 2023
cd7f455
Update on-tag.yml (#56)
PhilDigitalJustice Oct 18, 2023
8158f56
[Gradle Release Plugin] - pre tag commit: 'laa-ccms-caab-ebs-api-0.…
Oct 18, 2023
a28a98b
[Gradle Release Plugin] - new version commit: 'laa-ccms-caab-ebs-api…
Oct 18, 2023
3188ce3
fixes
PhilDigitalJustice Oct 18, 2023
b7d733b
revert version
PhilDigitalJustice Oct 18, 2023
a1c12de
remove old branch requirment
PhilDigitalJustice Oct 18, 2023
7c5a82f
Delete pr-merge-old.yml
PhilDigitalJustice Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: CI caab-data-api tag and deploy

on:
push:
tags:
- '*'

permissions:
contents: read
packages: write

jobs:
define-image-tag:
runs-on: ubuntu-latest
# map a step output to job output
outputs:
tag_name: ${{ steps.extract_tag_name.outputs.tag_name }}
repo_name: ${{ steps.extract_repo_name.outputs.repo_name }}
steps:
- name: Extract short repo name
shell: bash
run: echo "repo_name=caab-ebs${GITHUB_REPOSITORY#*\/laa-ccms-data}" >> $GITHUB_OUTPUT
id: extract_repo_name

build-test-publish:
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.capture_version.outputs.app_version }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build

- 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:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Capture version
shell: bash
id: capture_version
run: |
VERSION=$(grep "version=" gradle.properties | cut -d'=' -f2)
echo "app_version=${VERSION}" >> $GITHUB_OUTPUT
echo "Captured version: $VERSION"

- name: Upload jarfile
uses: actions/upload-artifact@v3
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 ]
runs-on: ubuntu-latest
permissions:
id-token: write # for requesting jwt
contents: read # for actions/checkout
steps:
# Checkout github repo
- uses: actions/checkout@v3
# Assume role in cloud platform
- name: download jar
uses: actions/download-artifact@v3
with:
name: data-api-jar

- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.DEV_ECR_ROLE_TO_ASSUME }}
aws-region: ${{ vars.DEV_ECR_REGION }}

- name: Login ecr
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr

# Build and push docker image to container repo
- name: Build and push image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ vars.DEV_ECR_REPOSITORY }}
REPO_NAME: ${{ needs.define-image-tag.outputs.repo_name }}
APP_VERSION: ${{ needs.build-test-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 }} .
docker push $REGISTRY/$REPOSITORY:${{ env.REPO_NAME }}-${{ env.APP_VERSION }}

- name: delete artifact
uses: geekyeggo/delete-artifact@v2
with:
name: data-api-jar

update-helm-chart:
needs: [ build-test-publish, ecr, define-image-tag ]
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout charts repo
uses: actions/checkout@v3
with:
repository: ministryofjustice/laa-ccms-caab-helm-charts
ref: development
path: laa-ccms-caab-helm-charts
token: ${{ secrets.REPO_TOKEN }}
- name: update helm chart
env:
REPO_NAME: ${{ needs.define-image-tag.outputs.repo_name }}
APP_VERSION: ${{ needs.build-test-publish.outputs.app_version }}
run: |
echo "${{ env.REPO_NAME }}-${{ env.APP_VERSION }}"
cd laa-ccms-caab-helm-charts/laa-ccms-caab-service/charts/laa-ccms-caab-ebs-api/
yq eval-all "( .appVersion = \"${{ env.REPO_NAME }}-${{ env.APP_VERSION }}\" )" -i Chart.yaml
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions Bot"
git add .
git commit -m "update appVersion to ${{ env.REPO_NAME }}-${{ env.APP_VERSION }}"
git push origin

update-laa-ccms-caab-ui:
needs: [ build-test-publish, define-image-tag ]
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout caab-ui repo
uses: actions/checkout@v3
with:
repository: ministryofjustice/laa-ccms-caab
ref: main
token: ${{ secrets.REPO_TOKEN }}

- name: Create a new branch
env:
APP_VERSION: ${{ needs.build-test-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 }}
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 }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions Bot"
git add build.gradle
git commit -m "Update data-api version to ${APP_VERSION}"
git push origin dependency/update-data-api-version-${APP_VERSION}

gh auth login --with-token <<< "${{ secrets.REPO_TOKEN }}"
gh pr create --base main --head dependency/update-data-api-version-${APP_VERSION} --title "Update data-api version to ${APP_VERSION}" --body "Automatic PR raised by GitHub Actions to update data-api version to ${APP_VERSION}"
57 changes: 57 additions & 0 deletions .github/workflows/pr-merge-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: CI caab-data-api pr to main

on:
pull_request:
branches: [ main ]
types: [ closed ]

permissions:
contents: read
packages: write

jobs:
build-test-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
token: ${{ secrets.REPO_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build

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

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

- name: Set to github user
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions Bot"

- name: Update version
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: release -Prelease.useAutomaticVersion=true

150 changes: 150 additions & 0 deletions .github/workflows/pr-merge-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
## This workflow uses actions that are not certified by GitHub.
PhilDigitalJustice marked this conversation as resolved.
Show resolved Hide resolved
## They are provided by a third-party and are governed by
## separate terms of service, privacy policy, and support
## documentation.
## This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
## For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
#
#name: CI caab-data-api
#
#on:
# pull_request:
# branches: [ main ]
# types: [ closed ]
#
#permissions:
# contents: read
# packages: write
#
#jobs:
# define-image-tag:
# if: github.event.pull_request.merged == true
# runs-on: ubuntu-latest
# # map a step output to job output
# outputs:
# tag_name: ${{ steps.extract_tag_name.outputs.tag_name }}
# steps:
# - name: Extract short repo name
# shell: bash
# run: echo "repo_name=caab-ebs${GITHUB_REPOSITORY#*\/laa-ccms-data}" >> $GITHUB_OUTPUT
# id: extract_repo_name
# - name: derive tag name
# shell: bash
# run: echo "tag_name=${{ steps.extract_repo_name.outputs.repo_name }}-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
# id: extract_tag_name
#
#
# build-test-publish:
# if: github.event.pull_request.merged == true
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Build with Gradle
# uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
# with:
# arguments: build
#
# - name: upload jarfile
# uses: actions/upload-artifact@v3
# with:
# name: data-api-jar
# path: data-service/build/libs/data-service-0.0.1-SNAPSHOT.jar
#
# - name: Test
# uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
# with:
# arguments: jacocoTestCoverageVerification
#
# - name: Integration Test
# uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
# with:
# arguments: integrationTest
#
# - name: Update snapshot version
# uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
# with:
# arguments: updateSnapshotVersion
#
# - name: Publish package
# uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
# with:
# arguments: publish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# ecr:
# if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
# needs: [build-test-publish, define-image-tag]
# runs-on: ubuntu-latest
# permissions:
# id-token: write # for requesting jwt
# contents: read # for actions/checkout
# steps:
# # Checkout github repo
# - uses: actions/checkout@v3
# # Assume role in cloud platform
# - name: download jar
# uses: actions/download-artifact@v3
# with:
# name: data-api-jar
#
# - name: Configure aws credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# role-to-assume: ${{ secrets.DEV_ECR_ROLE_TO_ASSUME }}
# aws-region: ${{ vars.DEV_ECR_REGION }}
#
# - name: Login ecr
# uses: aws-actions/amazon-ecr-login@v1
# id: login-ecr
#
# # Build and push docker image to container repo
# - name: Build and push image
# run: |
# docker build -t $REGISTRY/$REPOSITORY:${{ env.IMAGE_TAG }} .
# docker push $REGISTRY/$REPOSITORY:${{ env.IMAGE_TAG }}
# env:
# REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# REPOSITORY: ${{ vars.DEV_ECR_REPOSITORY }}
# IMAGE_TAG: ${{ needs.define-image-tag.outputs.tag_name }}
#
# - name: delete artifact
# uses: geekyeggo/delete-artifact@v2
# with:
# name: data-api-jar
#
# - name: delete artifact
# uses: geekyeggo/delete-artifact@v2
# with:
# name: data-api-jar
#
# update-helm-chart:
# needs: [ecr, define-image-tag]
# runs-on: ubuntu-latest
# environment: development
# steps:
# - name: Checkout charts repo
# uses: actions/checkout@v3
# with:
# repository: ministryofjustice/laa-ccms-caab-helm-charts
# ref: development
# path: laa-ccms-caab-helm-charts
# token: ${{ secrets.REPO_TOKEN }}
# - name: update helm chart
# env:
# IMAGE_TAG: ${{ needs.define-image-tag.outputs.tag_name }}
# run: |
# echo "$IMAGE_TAG"
# cd laa-ccms-caab-helm-charts/laa-ccms-caab-service/charts/laa-ccms-caab-ebs-api/
# yq eval-all "( .appVersion = \"${{ env.IMAGE_TAG }}\" )" -i Chart.yaml
# git config --global user.email "[email protected]"
# git config --global user.name "GitHub Actions Bot"
# git add .
# git commit -m "update appVersion to ${{ env.IMAGE_TAG }}"
# git push origin
#
Loading