Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publish api gateway #3

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Loading