Skip to content

Commit 5919139

Browse files
author
martinvibes
committed
Fix GetUserTickets function signature
2 parents ee8cc44 + a6620d0 commit 5919139

20 files changed

+1450
-823
lines changed

.github/workflows/prod.yml

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build, Test and Deploy to Prod
22

33
on:
4-
push:
4+
push:
55
branches:
66
- main
77

@@ -11,11 +11,22 @@ env:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
image_tag: ${{ steps.tag.outputs.tag }}
1416

1517
steps:
1618
- name: Checkout code
1719
uses: actions/checkout@v2
1820

21+
# Create unique tag from git commit + build number
22+
- name: Generate unique tag
23+
id: tag
24+
run: |
25+
SHORT_SHA=$(git rev-parse --short HEAD)
26+
TAG="build-${{ github.run_number }}-${SHORT_SHA}"
27+
echo "tag=$TAG" >> $GITHUB_OUTPUT
28+
echo "Generated tag: $TAG"
29+
1930
- name: Cache dependencies
2031
uses: actions/cache@v3
2132
with:
@@ -46,21 +57,25 @@ jobs:
4657
username: ${{ secrets.DOCKER_USERNAME }}
4758
password: ${{ secrets.DOCKER_PASSWORD }}
4859

49-
- name: Build and push Docker images
60+
- name: Build and push Docker images with unique tag
5061
uses: docker/bake-action@v2.3.0
62+
env:
63+
IMAGE_TAG: ${{ steps.tag.outputs.tag }}
5164
with:
5265
files: ./server/docker-bake.hcl
5366
push: true
5467
set: |
5568
*.cache-from=type=gha
5669
*.cache-to=type=gha,mode=max
5770
58-
# - name: Build and push indexer
59-
# uses: docker/build-push-action@v4
60-
# with:
61-
# context: ./the_last_indexer
62-
# push: true
63-
# tags: akshola00/paymesh-indexer:latest
71+
- name: Build and push indexer with unique tag
72+
uses: docker/build-push-action@v4
73+
with:
74+
context: ./the_last_indexer
75+
push: true
76+
tags: |
77+
paymesh/the-last-indexer:${{ steps.tag.outputs.tag }}
78+
paymesh/the-last-indexer:latest
6479
6580
deploy:
6681
needs: build
@@ -84,12 +99,17 @@ jobs:
8499

85100
- name: Deploy with environment variables
86101
uses: appleboy/ssh-action@master
102+
env:
103+
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
87104
with:
88105
host: ${{ vars.DROPLET_IP }}
89106
username: root
90107
password: ${{ secrets.DROPLET_PASSWORD }}
108+
envs: IMAGE_TAG
91109
script: |
92110
cd ~
111+
112+
# Create environment file
93113
cat > .env <<EOL
94114
RPC_URL=${{ secrets.RPC_URL }}
95115
PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}
@@ -108,12 +128,31 @@ jobs:
108128
JWT_EXPIRED_IN=${{ secrets.JWT_EXPIRED_IN }}
109129
JWT_MAXAGE=${{ secrets.JWT_MAXAGE }}
110130
PAYMESH_API_KEY=${{ secrets.PAYMESH_API_KEY }}
131+
IMAGE_TAG=${IMAGE_TAG}
111132
EOL
112133
134+
echo "Deploying with image tag: ${IMAGE_TAG}"
135+
136+
# Stop, pull new images, and restart
113137
docker compose --env-file .env stop
114138
docker compose --env-file .env pull
115139
docker compose --env-file .env up -d
116-
140+
141+
# Cleanup old images - keep last 5 versions
142+
echo "Cleaning up old images..."
143+
docker images "paymesh/server" --format "{{.Repository}}:{{.Tag}}" | \
144+
grep -v latest | \
145+
sort -r | \
146+
tail -n +6 | \
147+
xargs -r docker rmi || true
148+
149+
150+
# Remove dangling images
151+
docker image prune -f
152+
153+
echo "Deployment complete!"
154+
echo "Running containers:"
155+
docker ps
117156
# - name: Copy docker-compose.yml to paymesh indexer droplet
118157
# run: sshpass -v -p ${{ secrets.PAYMESH_DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no the_last_indexer/docker-compose.yml root@${{ vars.PAYMESH_DROPLET_IP }}:~
119158

server/.sqlx/query-1dc3836d0022f09069ff317fe90bb493ba753039ff14825748c3146881acd9d3.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/.sqlx/query-22b2c806c72f7276baaf59e5730eb4fd0f647f066d905ceb95cf58150407e83c.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/.sqlx/query-3802f0a5d1e2dacf7c0610d49f15bf417fc36424b181a0c5564a9d0767a52c52.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/.sqlx/query-61ea469b030f4c8e61c08fecbc1bdf17b9002a306cce434d6b71389765ea2b77.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/.sqlx/query-62036ed50deff9d480b111f47a363c3629d923b7d6ea4e40caff58ec60bf6ba1.json

Lines changed: 0 additions & 50 deletions
This file was deleted.

server/.sqlx/query-69e6cb0a06fc2e6df733a4093bd2ac093fd30f3ed4197be60bc106cff1993531.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)