Skip to content

Commit

Permalink
feat: publish api gateway (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
okjodom authored Oct 29, 2024
1 parent 9cafe9f commit af05979
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/publish-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: publish-api

on:
push:
paths:
- apps/api/**
- libs/**
- package.json
- bun.lockb
- .github/workflows/publish-api.yml
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
bitsacco/api
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: okjodom
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push api
uses: docker/build-push-action@v4
with:
file: apps/api/Dockerfile
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Checkout repository content
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: actions/checkout@v4

# This workflow requires the repository content to be locally available to read the README
- name: Update the Docker Hub description
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: peter-evans/dockerhub-description@v3
with:
username: okjodom
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: bitsacco/api
readme-filepath: ./apps/api/README.md
2 changes: 1 addition & 1 deletion apps/swap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ RUN bun install --production
COPY --from=development /usr/src/app/dist ./dist
COPY --from=development /usr/src/app/proto ./proto

CMD ["sh", "-c", "bun prisma migarate deploy && bun dist/apps/swap/main.js"]
CMD ["sh", "-c", "bun prisma migrate deploy && bun dist/apps/swap/main.js"]

0 comments on commit af05979

Please sign in to comment.