Skip to content

Commit cf0bf89

Browse files
committed
use ID dev workflows
1 parent cb3daff commit cf0bf89

File tree

6 files changed

+170
-14
lines changed

6 files changed

+170
-14
lines changed

.github/workflows/api-doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: Checkout
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343
with:
4444
ref: ${{ github.REF }}
4545
submodules: recursive

.github/workflows/api-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: Checkout
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343
with:
4444
submodules: recursive
4545
- name: Prepare folio-tools

.github/workflows/api-schema-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
with:
3434
submodules: recursive
3535
- name: Prepare folio-tools
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Very simple workflow to deploy the *latest* published container image with the 'latest' tag.
2+
# This does not post updated module descriptors to okapi, update permissions or enable
3+
# new versions of a module with the tenant. If that is needed, it should be done manually
4+
# via the Okapi API.
5+
6+
name: k8s-deploy-latest
7+
8+
env:
9+
K8S_NAMESPACE: 'folio-dev-new'
10+
K8S_DEPLOYMENT: 'mod-template-engine-dev'
11+
12+
on:
13+
workflow_dispatch
14+
15+
jobs:
16+
k8s-deploy-latest:
17+
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Deploy latest to K8s
21+
uses: actions-hub/[email protected]
22+
env:
23+
KUBE_CONFIG: ${{ secrets.FOLIO_DEV_NEW_SA_KUBECONFIG }}
24+
with:
25+
args:
26+
-n ${{ env.K8S_NAMESPACE }} rollout restart deployment ${{ env.K8S_DEPLOYMENT }}
27+
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: mvn-dev-build-deploy
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
workflow_dispatch:
8+
9+
env:
10+
PUBLISH_BRANCH: 'deployment'
11+
OKAPI_URL: 'https://folio-dev-new-okapi.folio-dev.indexdata.com'
12+
OKAPI_SECRET_USER: "${{ secrets.FOLIO_DEV_NEW_OKAPI_USER }}"
13+
OKAPI_SECRET_PASSWORD: "${{ secrets.FOLIO_DEV_NEW_OKAPI_PASSWORD }}"
14+
OK_SESSION: 'session1'
15+
16+
jobs:
17+
mvn-dev-build-deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
23+
submodules: recursive
24+
25+
- name: Set up JDK 17
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: 17
29+
distribution: 'temurin' # Alternative distribution options are available.
30+
31+
- name: Prepare okclient
32+
run: git clone https://github.com/indexdata/okclient
33+
34+
- name: Ensure OK and FOLIO login
35+
# So do not proceed with other workflow steps if not available.
36+
run: |
37+
source okclient/ok.sh
38+
OK -S ${{ env.OK_SESSION }} \
39+
-h ${{ env.OKAPI_URL }} \
40+
-t "supertenant" \
41+
-u ${{ env.OKAPI_SECRET_USER }} \
42+
-p ${{ env.OKAPI_SECRET_PASSWORD }}
43+
OK -S ${{ env.OK_SESSION }} -x
44+
45+
- name: Gather some variables
46+
run: |
47+
echo "MODULE_NAME=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV
48+
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
49+
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
50+
51+
- name: Set module version
52+
run: |
53+
echo "MODULE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-${SHA_SHORT}" >> $GITHUB_ENV
54+
55+
- name: Cache SonarCloud packages
56+
uses: actions/cache@v4
57+
with:
58+
path: ~/.sonar/cache
59+
key: ${{ runner.os }}-sonar
60+
restore-keys: ${{ runner.os }}-sonar
61+
62+
- name: Cache Maven packages
63+
uses: actions/cache@v4
64+
with:
65+
path: ~/.m2
66+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
67+
restore-keys: ${{ runner.os }}-m2
68+
69+
- name: Build and SQ analyze
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
72+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
73+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=indexdata -Dsonar.projectKey=indexdata_${{ github.event.repository.name }}
74+
75+
- name: Update ModuleDescriptor Id
76+
run: |
77+
if test -f "$MOD_DESCRIPTOR"; then
78+
echo "Found $MOD_DESCRIPTOR"
79+
cat <<< $(jq '.id = "${{ env.MODULE_NAME}}-${{ env.MODULE_VERSION }}"' $MOD_DESCRIPTOR) > $MOD_DESCRIPTOR
80+
echo "MODULE_DESCRIPTOR=$MOD_DESCRIPTOR" >> $GITHUB_ENV
81+
else
82+
echo "Could not find $MOD_DESCRIPTOR"
83+
exit 1
84+
fi
85+
env:
86+
MOD_DESCRIPTOR: './target/ModuleDescriptor.json'
87+
88+
- name: Read ModuleDescriptor
89+
id: moduleDescriptor
90+
uses: juliangruber/read-file-action@v1
91+
with:
92+
path: ${{ env.MODULE_DESCRIPTOR }}
93+
94+
- name: Login to Index Data Docker Hub account
95+
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
96+
uses: docker/login-action@v3
97+
with:
98+
username: ${{ secrets.DOCKER_USER }}
99+
password: ${{ secrets.DOCKER_PASSWORD }}
100+
101+
- name: Build and publish Docker image
102+
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
103+
uses: docker/build-push-action@v6
104+
with:
105+
context: .
106+
push: true
107+
tags: indexdata/${{ env.MODULE_NAME }}:${{ env.MODULE_VERSION }},indexdata/${{ env.MODULE_NAME }}:latest
108+
109+
- name: Publish ModuleDescriptor to Okapi
110+
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
111+
run: |
112+
source okclient/ok.sh
113+
echo "Do login ..."
114+
OK -S ${{ env.OK_SESSION }} \
115+
-h ${{ env.OKAPI_URL }} \
116+
-t "supertenant" \
117+
-u ${{ env.OKAPI_SECRET_USER }} \
118+
-p ${{ env.OKAPI_SECRET_PASSWORD }}
119+
echo "Post the MD and report the response status ..."
120+
OK -S ${{ env.OK_SESSION }} _/proxy/modules \
121+
-X post -f ${{ env.MODULE_DESCRIPTOR }}
122+
declare -n NAMEREF_STATUS=${{ env.OK_SESSION }}_HTTPStatus
123+
echo "Response status: $NAMEREF_STATUS"
124+
echo "Do logout ..."
125+
OK -S ${{ env.OK_SESSION }} -x
126+
127+
- name: Print module version to job summary
128+
run: |
129+
echo "#### Module Version: ${{ env.MODULE_VERSION }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/postgres.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
postgres: ${{ fromJSON(github.event.inputs.postgres) }}
1414
fail-fast: false
1515
steps:
16-
- uses: actions/checkout@v4
17-
with:
18-
submodules: true
19-
- uses: actions/setup-java@v4
20-
with:
21-
distribution: 'temurin'
22-
java-version: '17'
23-
cache: maven
24-
- run: mvn --batch-mode verify
25-
env:
26-
TESTCONTAINERS_POSTGRES_IMAGE: ${{ matrix.postgres }}
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: true
19+
- uses: actions/setup-java@v4
20+
with:
21+
distribution: 'temurin'
22+
java-version: '17'
23+
cache: maven
24+
- run: mvn --batch-mode verify
25+
env:
26+
TESTCONTAINERS_POSTGRES_IMAGE: ${{ matrix.postgres }}

0 commit comments

Comments
 (0)