testing new gitea workflow
Some checks failed
Build and Deploy NextJS SculptedArc Website / build-and-deploy (push) Failing after 2s
Some checks failed
Build and Deploy NextJS SculptedArc Website / build-and-deploy (push) Failing after 2s
This commit is contained in:
@@ -1,22 +1,52 @@
|
|||||||
name: Gitea Actions Demo
|
name: Build and Deploy NextJS SculptedArc Website
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
on:
|
||||||
on: [push]
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Explore-Gitea-Actions:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: sh
|
shell: sh
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo "This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- run: echo "The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "The workflow is now ready to test your code on the runner."
|
- name: Set up Docker Buildx
|
||||||
- name: List files in the repository
|
uses: actions/setup-buildx-action@v3
|
||||||
run: |
|
|
||||||
ls ${{ gitea.workspace }}
|
# 1. Log into your self-hosted Gitea container storage layer
|
||||||
- run: echo "This job's status is ${{ job.status }}."
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: actions/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.sculpted-arc.co.uk # Change to your Gitea domain
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.TOKEN_GITEA }}
|
||||||
|
|
||||||
|
# 2. Build the Dockerfile and upload the compiled app image
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
uses: actions/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: gitea.sculpted-arc.co.uk/${{ gitea.repository }}:latest
|
||||||
|
|
||||||
|
# 3. Securely SSH to the host using masked secrets
|
||||||
|
- name: Deploy to Server via SSH
|
||||||
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SERVER_HOST }}
|
||||||
|
username: root
|
||||||
|
key: ${{ secrets.SSH_PRIVATE_KEY }} # Completely invisible to anyone viewing code
|
||||||
|
script: |
|
||||||
|
cd /home/james/docker/sculpted-arc-site
|
||||||
|
|
||||||
|
# Authenticate the host machine to pull from Gitea's registry
|
||||||
|
docker login -u ${{ gitea.actor }} -p ${{ secrets.TOKEN_GITEA }} gitea.sculpted-arc.co.uk
|
||||||
|
|
||||||
|
# Pull down the fresh image we just built and restart gracefully
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d --remove-orphans
|
||||||
Reference in New Issue
Block a user