Working base server with migrations and build steps ironed out (#1)
Reviewed-on: #1 Co-authored-by: Joseph Nelson <joseph.nelson4456@gmail.com> Co-committed-by: Joseph Nelson <joseph.nelson4456@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
name: Build and Push Image
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [closed]
|
||||
jobs:
|
||||
build-and-push:
|
||||
if: gitea.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitea.nelson-household.com # Replace with your Gitea domain
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.RUNNER_TOKEN }}
|
||||
|
||||
- name: Delete Old Images and Containers
|
||||
run: |
|
||||
docker ps -a -q -f "name=tcg-collectors-server" | xargs -I {} docker rm {} || true
|
||||
docker images --format "{{.Repository}}:{{.Tag}}" | grep "tcg-collectors-server" | xargs -I {} docker rmi {} || true
|
||||
|
||||
- name: Build and Push Image
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg DATABASE_URL=${{ secrets.DATABASE_URL }} \
|
||||
-t gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }} .
|
||||
docker push gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }}
|
||||
|
||||
- name: Execute Migrations
|
||||
run: |
|
||||
docker run gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }} npm run migrate up
|
||||
Reference in New Issue
Block a user