This repository has been archived by the owner on Jan 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gnoswap-labs/docker-deploy
chore: Update Dockerfile and add deployment workflow
- Loading branch information
Showing
3 changed files
with
98 additions
and
1 deletion.
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,51 @@ | ||
name: Deploy by create tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*-beta' | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: development | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ secrets.REGISTRY_URL }} | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Build and push image to docker registry | ||
id: build-image | ||
env: | ||
REGISTRY_URL: ${{ secrets.REGISTRY_URL }} | ||
REGISTRY_GROUP: gnoswap | ||
REGISTRY_SERVICE: grc20-register | ||
IMAGE_TAG: ${{ github.ref_name }} | ||
run: | | ||
# Build docker images | ||
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG . | ||
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:latest . | ||
# Push images | ||
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG | ||
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:latest | ||
echo "image=$REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Redeploy service | ||
uses: actions-hub/kubectl@master | ||
env: | ||
REGISTRY_URL: ${{ secrets.REGISTRY_URL }} | ||
REGISTRY_GROUP: gnoswap | ||
IMAGE_TAG: ${{ github.ref_name }} | ||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_BETA }} | ||
KUBE_DEPLOYMENT_NAME: grc20-register | ||
KUBE_NAMESPACE: beta-gno | ||
with: | ||
args: set image deployment/${{ env.KUBE_DEPLOYMENT_NAME }} container-0=${{ env.REGISTRY_URL }}/${{ env.REGISTRY_GROUP }}/${{ env.KUBE_DEPLOYMENT_NAME }}:${{ env.IMAGE_TAG }} -n ${{ env.KUBE_NAMESPACE }} |
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,46 @@ | ||
name: Deploy by main push | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: development | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ secrets.REGISTRY_URL }} | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Build and push image to docker registry | ||
id: build-image | ||
env: | ||
REGISTRY_URL: ${{ secrets.REGISTRY_URL }} | ||
REGISTRY_GROUP: gnoswap | ||
REGISTRY_SERVICE: grc20-register | ||
IMAGE_TAG: main | ||
run: | | ||
# Build docker images | ||
docker build -t $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG . | ||
# Push images | ||
docker push $REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG | ||
echo "image=$REGISTRY_URL/$REGISTRY_GROUP/$REGISTRY_SERVICE:$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Redeploy service | ||
uses: actions-hub/kubectl@master | ||
env: | ||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_DEV }} | ||
KUBE_DEPLOYMENT_NAME: grc20-register | ||
KUBE_NAMESPACE: dev-gno | ||
with: | ||
args: rollout restart deployment/${{ env.KUBE_DEPLOYMENT_NAME }} -n ${{ env.KUBE_NAMESPACE }} |
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