Skip to content

Commit

Permalink
chore: update docker push workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Feb 2, 2024
1 parent 593f3ea commit e286b1a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 22 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,47 @@ jobs:
docker compose up -d
pnpm run e2e:api
docker compose down
build-api-alpha:
needs: validate
runs-on: ubuntu-latest
name: Build and push API docker image for alpha
if: ${{ startsWith(github.ref , 'refs/tags/') && contains(github.ref, 'alpha') }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t keyshade/keyshade-api:${{ github.ref_name }} keyshade/keyshade-api:alpha-latest -f ./apps/api/Dockerfile .

- name: Push Docker image
run: docker push keyshade/keyshade-api

build-api-release:
needs: validate
runs-on: ubuntu-latest
name: Build and push API docker image for release
if: ${{ startsWith(github.ref , 'refs/tags/') && !contains(github.ref, 'alpha') }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t keyshade/keyshade-api:${{ github.ref_name }} keyshade/keyshade-api:latest -f ./apps/api/Dockerfile .

- name: Push Docker image
run: docker push keyshade/keyshade-api
32 changes: 11 additions & 21 deletions .github/workflows/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
push:
paths: ['apps/web/**', '.github/workflows/web.yaml']
tags:
- 'v*.*.*'
- '*'
pull_request:
paths: ['apps/web/**']

Expand Down Expand Up @@ -51,15 +51,15 @@ jobs:
run: |
pnpm run test:web
build-alpha:
build-web-alpha:
needs: validate
if: ${{ github.ref == 'refs/tags/v*.*.*-alpha' && github.event_name == 'push' }}
runs-on: ubuntu-latest
name: Build and push docker image
name: Build and push Web docker image for alpha
if: ${{ startsWith(github.ref , 'refs/tags/') && contains(github.ref, 'alpha') }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
Expand All @@ -68,20 +68,20 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t keyshade/keyshade-web:${{ github.ref_name }}-alpha -f ./apps/web/Dockerfile .
run: docker build -t keyshade/keyshade-web:${{ github.ref_name }} keyshade/keyshade-web:alpha-latest -f ./apps/web/Dockerfile .

- name: Push Docker image
run: docker push keyshade/keyshade-web

build-release:
build-web-release:
needs: validate
if: ${{ github.ref == 'refs/tags/v*.*.*' && github.event_name == 'push' }}
runs-on: ubuntu-latest
name: Build and push docker image
name: Build and push Web docker image for release
if: ${{ startsWith(github.ref , 'refs/tags/') && !contains(github.ref, 'alpha') }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
Expand All @@ -90,17 +90,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t keyshade/keyshade-web:latest -t keyshade/keyshade-web:${{ github.ref_name }} -f ./apps/web/Dockerfile .
run: docker build -t keyshade/keyshade-web:${{ github.ref_name }} keyshade/keyshade-web:latest -f ./apps/web/Dockerfile .

- name: Push Docker image
run: docker push keyshade/keyshade-web

deploy:
needs: build-release
if: ${{ github.ref == 'refs/tags/v*.*.*' && github.event_name == 'push' }}
runs-on: ubuntu-latest
name: Deploy to Render

steps:
- name: deploy
run: curl ${{ secrets.RENDER_WEB_DEPLOY_HOOK }}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Please ensure your pull request adheres to the following guidelines:
- Write good commit messages by following [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
- Include relevant issue number if applicable.
- Your PR should follow this pattern: `fix|feat|chore|docs|style|refactor|perf|test|ci|build|breaking-change|revert: <description>`. For example, `feat: add new feature` or `fix: fix a bug`. Note that description can contain only alphanumeric characters and `-`, `.` and `_` characters.
- Before you make a push to your branch, make sure you rebase your branch with the latest changes from the `main` branch.
- Before you make a push to your branch, make sure you rebase your branch with the latest changes from the `develop` branch.

## Documentation

Expand Down

0 comments on commit e286b1a

Please sign in to comment.