62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
name: Build and Push to Digital Ocean Container Registry
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: portal-builder
|
|
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
rm -rf ./* ./.[!.]* 2>/dev/null || true
|
|
git config --global http.extraheader "Authorization: token ${{ github.token }}"
|
|
git clone --branch "${{ gitea.ref_name }}" \
|
|
"${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
|
|
|
- name: Build image
|
|
run: |
|
|
docker build --platform linux/amd64 \
|
|
-t registry.digitalocean.com/radiantwave-portal-container-registry/portal:${{ gitea.sha }} \
|
|
-t registry.digitalocean.com/radiantwave-portal-container-registry/portal:latest \
|
|
.
|
|
|
|
- name: Login to DigitalOcean Registry
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
registry: registry.digitalocean.com
|
|
username: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push registry.digitalocean.com/radiantwave-portal-container-registry/portal:${{ gitea.sha }}
|
|
docker push registry.digitalocean.com/radiantwave-portal-container-registry/portal:latest
|
|
|
|
migrate:
|
|
needs: build-and-push
|
|
runs-on: portal-builder
|
|
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
rm -rf ./* ./.[!.]* 2>/dev/null || true
|
|
git config --global http.extraheader "Authorization: token ${{ github.token }}"
|
|
git clone --branch "${{ gitea.ref_name }}" \
|
|
"${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
|
|
|
- name: Setup Node
|
|
uses: https://github.com/actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run database migrations
|
|
env:
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
NODE_EXTRA_CA_CERTS: ./digital-ocean.crt
|
|
run: npm run deploy |