-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/GitHub actions to publish lock manager image (#11)
git workflow for creating pit-lock-manager image and pushing to ghcr.io --------- Co-authored-by: Amninder Kaur <[email protected]>
- Loading branch information
Showing
7 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: build | ||
|
||
on: push | ||
|
||
jobs: | ||
npm_build: | ||
uses: ./.github/workflows/npm_build.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: ghcr.io Publish | ||
|
||
# when a new release is created or new tag is pushed to master | ||
# tag should be in the format v1.0.0 | ||
# v1.0.0-alpha.1 is also valid | ||
# regex to check the tag format | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-[a-zA-Z]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z]+)+.[0-9]?' | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/npm_build.yml | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: needs.build.result == 'success' | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- run: PATH=$PATH:$(pwd) bin/ubuntu-setup.sh | ||
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- run: | | ||
echo $RELEASE_VERSION | ||
echo ${{ env.RELEASE_VERSION }} | ||
- name: Build and publish lock manager image with ver and latest tag | ||
run: sh bin/ghcr-publish.sh lock-manager $RELEASE_VERSION | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# workflow_call to build the rust app | ||
name: npm_build_and_test | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
check-latest: true | ||
- name: npm install, build and test lock-manager | ||
run: sh bin/npm-build.sh lock-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
package_name=$1 | ||
version=$2 | ||
|
||
cd $package_name | ||
tag_with_version=pit-$package_name:$version | ||
tag_ref=ghcr.io/kindredgroup/pit-toolkit/$tag_with_version | ||
echo $tag_ref | ||
docker build . --tag $tag_ref | ||
#for ghcr.io access token mentioned in the github secrets and accessed in actions | ||
docker push $tag_ref |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
package_name=$1 | ||
|
||
echo "Building $package_name" | ||
cd $(pwd)/$package_name | ||
npm ci | ||
npm run build | ||
npm run test | ||
cd ../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
sudo apt-get update && sudo apt-get install -y libsasl2-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
LOCAL_HOST_IP=$(ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}') | ||
|
||
K8S_NAMESPACE=dev | ||
REGISTRY_URL=ksp | ||
#IMAGE_TAG=$(git rev-parse --short HEAD) | ||
IMAGE_TAG=dev | ||
|
||
SERVICE_NAME=lock-manager | ||
SERVICE_PORT=60001 | ||
|
||
# POSTGRES | ||
PGHOST=$LOCAL_HOST_IP | ||
PGPORT= | ||
PGUSER= | ||
PGPASSWORD= | ||
PGDATABASE= | ||
PGMINPOOLSIZE=10 | ||
|
||
#DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$PGDATABASE?sslmode=disable | ||
|
||
RENEW_BY_IN_SEC=60 | ||
ENVIRONMENT=dev |