Skip to content

Commit

Permalink
feat: DEVOPS-1844 add image pipeline (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmeds authored Jan 28, 2025
1 parent 876bc12 commit 742d3c4
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git
.gitignore
.github
.dockerignore
node_modules
npm-debug.log
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/cicd-prd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "CICD production"

on:
# On release
release:
types: [published]

jobs:
build:
permissions:
id-token: write
contents: write
runs-on: ubuntu-24.04
if: github.actor != 'dependabot[bot]'
name: "Build image"
strategy:
fail-fast: false
matrix:
application: [ethstats-server]
include:
- application: ethstats-server
image_name: ethstats-server
path: .
tag_length: 8
tag_latest: true
env:
REGISTRY: asia-docker.pkg.dev
REPOSITORY: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Docker build and push
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
with:
file: ${{ matrix.file }}
context: ${{ matrix.context }}
push: ${{ github.ref_name == github.event.repository.default_branch }}
tag: ${{ env.REPOSITORY }}/${{ matrix.image_name }}:${{ github.ref_name }}
tag-length: 8
tag-latest: ${{ matrix.tag_latest }}
registry: ${{ env.REGISTRY }}
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service-account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}"
cache-key: ${{ env.REPOSITORY }}/${{ matrix.image_name }}-cache
secrets: |
"TOKEN=${{ secrets.GH_PAT }}"
58 changes: 58 additions & 0 deletions .github/workflows/cicd-stg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "CICD staging"

on:
# Test run before merging
pull_request:
branches:
- main
# On merged
push:
branches:
- main

jobs:
build:
permissions:
id-token: write
contents: write
runs-on: ubuntu-24.04
if: github.actor != 'dependabot[bot]'
name: "Build image"
strategy:
fail-fast: false
matrix:
application: [ethstats-server]
include:
- application: ethstats-server
image_name: ethstats-server
file: Dockerfile
context: "."
tag_length: 8
tag_latest: false
env:
REGISTRY: asia-docker.pkg.dev
REPOSITORY: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Docker build and push
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
with:
file: ${{ matrix.file }}
context: ${{ matrix.context }}
push: ${{ github.ref_name == github.event.repository.default_branch }}
tag: ${{ env.REPOSITORY }}/${{ matrix.image_name }}
tag-length: 8
tag-latest: ${{ matrix.tag_latest }}
registry: ${{ env.REGISTRY }}
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service-account: "${{ secrets.GCP_STG_GITHUB_SA_DOCKER_REGISTRY }}"
cache-key: ${{ env.REPOSITORY }}/${{ matrix.image_name }}-cache
secrets: |
"TOKEN=${{ secrets.GH_PAT }}"

0 comments on commit 742d3c4

Please sign in to comment.