Skip to content

Commit a8a86b3

Browse files
committed
docker build
1 parent ee99df1 commit a8a86b3

File tree

1 file changed

+94
-9
lines changed

1 file changed

+94
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and deploy to Fly.io
1+
name: Build and deploy
22

33
on:
44
push:
@@ -7,10 +7,16 @@ on:
77
- main
88
workflow_dispatch:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
11-
build-n-deploy:
12-
runs-on: ubicloud-standard-2
13-
environment: ${{ github.ref_name }}
15+
build:
16+
if: |
17+
!contains(github.event.head_commit.message, 'skip build')
18+
permissions: write-all
19+
runs-on: ubicloud-standard-16
1420
steps:
1521
- name: Checkout your repository using git
1622
uses: actions/checkout@v4
@@ -33,8 +39,87 @@ jobs:
3339
- name: Build
3440
run: pnpm run build
3541

36-
- uses: superfly/flyctl-actions/setup-flyctl@master
37-
- run: flyctl deploy --remote-only
38-
env:
39-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
40-
FLY_APP: ${{ vars.APP_NAME }}
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Docker Login
46+
uses: docker/[email protected]
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Prepare build
53+
run: |
54+
echo "SANITIZED_REF=$(echo "${GITHUB_REF##*/}" | tr '/' '-')" >> $GITHUB_ENV
55+
56+
- id: commit
57+
uses: prompt/actions-commit-hash@v3
58+
59+
- name: Build and push
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: .
63+
push: true
64+
file: Dockerfile
65+
tags: |
66+
ghcr.io/renlabs-dev/torus-docs:${{ steps.commit.outputs.short }}
67+
ghcr.io/renlabs-dev/torus-docs:${{ env.SANITIZED_REF }}
68+
69+
clean-stale:
70+
runs-on: ubicloud-standard-2
71+
container:
72+
image: ghcr.io/renlabs-dev/devops-ci:latest
73+
74+
env:
75+
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
76+
VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }}
77+
VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }}
78+
79+
steps:
80+
- name: Setup Kubernetes authentication
81+
run: /apps/k8s_auth_w_approle_sa.sh
82+
83+
- name: Clean stale releases
84+
run: |
85+
/apps/clean_stale_releases.sh torus-docs
86+
87+
# deploy:
88+
# needs: [build, clean-stale]
89+
# runs-on: ubicloud-standard-2
90+
# environment: ${{ github.ref_name }}
91+
# container:
92+
# image: ghcr.io/renlabs-dev/devops-ci:latest
93+
94+
# env:
95+
# VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
96+
# VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }}
97+
# VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }}
98+
99+
# steps:
100+
# - name: Checkout repository
101+
# uses: actions/checkout@v4
102+
103+
# - name: Setup Kubernetes authentication
104+
# run: /apps/k8s_auth_w_approle_sa.sh
105+
106+
# - name: Add and update Helm repositories
107+
# run: |
108+
# helm repo add renlabs https://charts.renlabs.dev/
109+
# helm repo update
110+
111+
# - id: commit
112+
# uses: prompt/actions-commit-hash@v3
113+
114+
# - name: Set environment variables
115+
# run: |
116+
# SANITIZED_REF=$(echo "${GITHUB_REF##*/}" | tr '/' '-')
117+
# echo "SANITIZED_REF=$SANITIZED_REF" >> $GITHUB_ENV
118+
# echo "INGRESS=$([ "$SANITIZED_REF" == "main" ] && echo "docs.torus.network" || echo "$SANITIZED_REF.docs.torus.network")" >> $GITHUB_ENV
119+
120+
# - name: Deploy application
121+
# run: |
122+
# helmfile sync \
123+
# --state-values-set releaseName=${{ env.SANITIZED_REF }}-torus-docs \
124+
# --state-values-set ingressHost=${{ env.INGRESS }} \
125+
# --set deployment.image.tag=${{ steps.commit.outputs.short }}

0 commit comments

Comments
 (0)