Skip to content

Commit

Permalink
githubactions
Browse files Browse the repository at this point in the history
  • Loading branch information
ogis-yamanaka committed Oct 28, 2024
1 parent 8c8ebb3 commit 8da5e1a
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 26 deletions.
37 changes: 28 additions & 9 deletions .github/workflows/build-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Go CI

on:
push:
branches: ["develop", "feature/*", "hotfix/*"]
branches: ['develop', 'feature/*', 'hotfix/*']
paths:
- "cmd/**"
- "pkg/**"
- "package/**"
- ".github/**"
- 'cmd/**'
- 'pkg/**'
- 'package/**'
- '.github/**'
workflow_dispatch:

permissions:
Expand All @@ -25,24 +25,33 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout manifest repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nautible/nautible-app-examples-manifest
path: nautible-app-examples-manifest
token: ${{ secrets.PAT }}

# AWS
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
id: login-aws
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-ecr-access-role
aws-region: ap-northeast-1
continue-on-error: true

- name: login-aws when command failure
run: echo "result - aws login failure"
if: steps.login-aws.outcome == 'failure'

- name: Login to Amazon public ECR
id: login-ecr
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/nautible
if: steps.login-aws.outcome == 'success'

- name: examples go Build, tag, and push image to Amazon ECR
id: build-image-service-ecr
env:
Expand All @@ -55,19 +64,28 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
if: steps.login-aws.outcome == 'success'

# Azure
- name: Login via Azure CLI
id: login-acr
id: login-azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
continue-on-error: true

- name: login-azure when command failure
run: echo "result - azure login failure"
if: steps.login-azure.outcome == 'failure'

- name: Login Azure Acr
id: login-azure-acr
run: |
az acr login -n nautibledevacr
if: steps.login-azure.outcome == 'success'

- name: examples go Build, tag, and push image to Azure ACR
id: build-image-service-acr
env:
Expand All @@ -79,6 +97,7 @@ jobs:
docker build --cache-from=$ACR_REGISTRY/$ACR_REPOSITORY:latest --build-arg CLOUD=azure --build-arg BUILDKIT_INLINE_CACHE=1 -t $ACR_REGISTRY/$ACR_REPOSITORY:latest -t $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG -f ./package/examples/Dockerfile .
docker push $ACR_REGISTRY/$ACR_REPOSITORY:latest
docker push $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG
if: steps.login-azure.outcome == 'success'

- name: update feature branch image tag
id: update-feature-branch-image-tag
Expand Down
33 changes: 26 additions & 7 deletions .github/workflows/build-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Java CI with Maven

on:
push:
branches: ["develop", "feature/*", "hotfix/*"]
branches: ['develop', 'feature/*', 'hotfix/*']
workflow_dispatch:

permissions:
Expand All @@ -23,19 +23,19 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout manifest repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nautible/nautible-app-examples-manifest
path: nautible-app-examples-manifest
token: ${{ secrets.PAT }}
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 11
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand All @@ -45,14 +45,23 @@ jobs:
- name: pacakge with Maven for aws
run: mvn -B package -Dcloud=aws --file nautible-app-examples-java/pom.xml -Dquarkus.package.type=fast-jar
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
id: login-aws
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-ecr-access-role
aws-region: ap-northeast-1
continue-on-error: true

- name: login-aws when command failure
run: echo "result - aws login failure"
if: steps.login-aws.outcome == 'failure'

- name: Login to Amazon public ECR
id: login-ecr
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/nautible
if: steps.login-aws.outcome == 'success'

- name: examples java Build, tag, and push image to Amazon ECR
id: build-image-service-ecr
env:
Expand All @@ -65,23 +74,32 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
if: steps.login-aws.outcome == 'success'

# Azure
- name: pacakge with Maven for Azure
run: |
cd $GITHUB_WORKSPACE
mvn -B clean package -Dcloud=azure --file nautible-app-examples-java/pom.xml -Dquarkus.package.type=fast-jar
- name: Login via Azure CLI
id: login-acr
id: login-azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
continue-on-error: true

- name: login-azure when command failure
run: echo "result - azure login failure"
if: steps.login-azure.outcome == 'failure'

- name: Login Azure Acr
id: login-azure-acr
run: |
az acr login -n nautibledevacr
if: steps.login-azure.outcome == 'success'

- name: examples java Build, tag, and push image to Azure ACR
id: build-image-service-acr
env:
Expand All @@ -93,6 +111,7 @@ jobs:
docker build --cache-from=$ACR_REGISTRY/$ACR_REPOSITORY:latest --build-arg BUILDKIT_INLINE_CACHE=1 -t $ACR_REGISTRY/$ACR_REPOSITORY:latest -t $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG -f ./src/main/docker/Dockerfile.jvm .
docker push $ACR_REGISTRY/$ACR_REPOSITORY:latest
docker push $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG
if: steps.login-azure.outcome == 'success'

- name: update feature branch image tag
id: update-feature-branch-image-tag
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/build-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Node CI

on:
push:
branches: ["develop", "feature/*", "hotfix/*"]
branches: ['develop', 'feature/*', 'hotfix/*']
workflow_dispatch:

permissions:
Expand All @@ -20,24 +20,33 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout manifest repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nautible/nautible-app-examples-manifest
path: nautible-app-examples-manifest
token: ${{ secrets.PAT }}

# AWS
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
id: login-aws
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-ecr-access-role
aws-region: ap-northeast-1
continue-on-error: true

- name: login-aws when command failure
run: echo "result - aws login failure"
if: steps.login-aws.outcome == 'failure'

- name: Login to Amazon public ECR
id: login-ecr
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/nautible
if: steps.login-aws.outcome == 'success'

- name: examples node Build, tag, and push image to Amazon ECR
id: build-image-service-ecr
env:
Expand All @@ -50,19 +59,28 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
if: steps.login-aws.outcome == 'success'

# Azure
- name: Login via Azure CLI
id: login-acr
id: login-azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
continue-on-error: true

- name: login-azure when command failure
run: echo "result - azure login failure"
if: steps.login-azure.outcome == 'failure'

- name: Login Azure Acr
id: login-azure-acr
run: |
az acr login -n nautibledevacr
if: steps.login-azure.outcome == 'success'

- name: examples node Build, tag, and push image to Azure ACR
id: build-image-service-acr
env:
Expand All @@ -74,6 +92,7 @@ jobs:
docker build --cache-from=$ACR_REGISTRY/$ACR_REPOSITORY:latest --build-arg BUILDKIT_INLINE_CACHE=1 -t $ACR_REGISTRY/$ACR_REPOSITORY:latest -t $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG -f ./docker/Dockerfile .
docker push $ACR_REGISTRY/$ACR_REPOSITORY:latest
docker push $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG
if: steps.login-azure.outcome == 'success'

- name: update feature branch image tag
id: update-feature-branch-image-tag
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Python CI

on:
push:
branches: ["develop", "feature/*", "hotfix/*"]
branches: ['develop', 'feature/*', 'hotfix/*']
workflow_dispatch:

permissions:
Expand All @@ -20,24 +20,32 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout manifest repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nautible/nautible-app-examples-manifest
path: nautible-app-examples-manifest
token: ${{ secrets.PAT }}

# AWS
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-ecr-access-role
aws-region: ap-northeast-1
continue-on-error: true

- name: login-aws when command failure
run: echo "result - aws login failure"
if: steps.login-aws.outcome == 'failure'

- name: Login to Amazon public ECR
id: login-ecr
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/nautible
if: steps.login-aws.outcome == 'success'

- name: examples python Build, tag, and push image to Amazon ECR
id: build-image-service-ecr
env:
Expand All @@ -50,19 +58,28 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
if: steps.login-aws.outcome == 'success'

# Azure
- name: Login via Azure CLI
id: login-acr
id: login-azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
continue-on-error: true

- name: login-azure when command failure
run: echo "result - azure login failure"
if: steps.login-azure.outcome == 'failure'

- name: Login Azure Acr
id: login-azure-acr
run: |
az acr login -n nautibledevacr
if: steps.login-azure.outcome == 'success'

- name: examples python Build, tag, and push image to Azure ACR
id: build-image-service-acr
env:
Expand All @@ -74,6 +91,7 @@ jobs:
docker build --cache-from=$ACR_REGISTRY/$ACR_REPOSITORY:latest --build-arg BUILDKIT_INLINE_CACHE=1 -t $ACR_REGISTRY/$ACR_REPOSITORY:latest -t $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG -f ./docker/Dockerfile .
docker push $ACR_REGISTRY/$ACR_REPOSITORY:latest
docker push $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG
if: steps.login-azure.outcome == 'success'

- name: update feature branch image tag
id: update-feature-branch-image-tag
Expand Down

0 comments on commit 8da5e1a

Please sign in to comment.