feat: initial commit — polymarket-bot source + CI/CD pipeline
CI/CD / build-and-push (push) Failing after 30s
CI/CD / build-and-push (push) Failing after 30s
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY: git.chemavx.xyz
|
||||
IMAGE_BOT: git.chemavx.xyz/chemavx/polymarket-bot
|
||||
IMAGE_API: git.chemavx.xyz/chemavx/polymarket-bot-api
|
||||
K8S_MANIFESTS_REPO: https://chemavx:${{ secrets.CI_TOKEN }}@git.chemavx.xyz/chemavx/k8s-manifests.git
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set image tag
|
||||
id: tag
|
||||
run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Login to Gitea registry
|
||||
run: |
|
||||
echo "${{ secrets.CI_TOKEN }}" | docker login ${{ env.REGISTRY }} \
|
||||
-u chemavx --password-stdin
|
||||
|
||||
- name: Build bot image
|
||||
run: |
|
||||
docker build \
|
||||
-f Dockerfile \
|
||||
-t ${{ env.IMAGE_BOT }}:${{ steps.tag.outputs.TAG }} \
|
||||
-t ${{ env.IMAGE_BOT }}:latest \
|
||||
.
|
||||
|
||||
- name: Build API image
|
||||
run: |
|
||||
docker build \
|
||||
-f Dockerfile.api \
|
||||
-t ${{ env.IMAGE_API }}:${{ steps.tag.outputs.TAG }} \
|
||||
-t ${{ env.IMAGE_API }}:latest \
|
||||
.
|
||||
|
||||
- name: Push bot image
|
||||
run: |
|
||||
docker push ${{ env.IMAGE_BOT }}:${{ steps.tag.outputs.TAG }}
|
||||
docker push ${{ env.IMAGE_BOT }}:latest
|
||||
|
||||
- name: Push API image
|
||||
run: |
|
||||
docker push ${{ env.IMAGE_API }}:${{ steps.tag.outputs.TAG }}
|
||||
docker push ${{ env.IMAGE_API }}:latest
|
||||
|
||||
- name: Update k8s manifests
|
||||
run: |
|
||||
TAG=${{ steps.tag.outputs.TAG }}
|
||||
|
||||
git config --global user.email "ci@git.chemavx.xyz"
|
||||
git config --global user.name "Gitea CI"
|
||||
|
||||
git clone ${{ env.K8S_MANIFESTS_REPO }} /tmp/k8s-manifests
|
||||
cd /tmp/k8s-manifests
|
||||
|
||||
# Update bot image
|
||||
sed -i "s|image: .*polymarket-bot.*|image: ${{ env.IMAGE_BOT }}:${TAG}|g" \
|
||||
polymarket-bot/deployment-bot.yaml
|
||||
|
||||
# Update API image
|
||||
sed -i "s|image: .*polymarket-bot-api.*|image: ${{ env.IMAGE_API }}:${TAG}|g" \
|
||||
polymarket-bot/deployment-api.yaml
|
||||
|
||||
# Fix imagePullPolicy to Always (registry instead of local)
|
||||
sed -i "s|imagePullPolicy: Never|imagePullPolicy: Always|g" \
|
||||
polymarket-bot/deployment-bot.yaml \
|
||||
polymarket-bot/deployment-api.yaml
|
||||
|
||||
git add polymarket-bot/deployment-bot.yaml polymarket-bot/deployment-api.yaml
|
||||
git diff --cached --quiet || git commit -m "ci: update polymarket-bot images to ${TAG} [skip ci]"
|
||||
git push
|
||||
Reference in New Issue
Block a user