Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Has been skipped
checks / Set up Java for Backend Tests and Build (push) Has been skipped
Gitea Actions Demo / Explore Gitea Actions - 2 (pull_request) Has been skipped
Gitea Actions Demo 2 / Builder (pull_request) Failing after 8s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Has been skipped
checks / Set up Java for Backend Tests and Build (pull_request) Has been skipped
113 lines
3.6 KiB
YAML
113 lines
3.6 KiB
YAML
name: Gitea Actions Demo
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
Explore-Gitea-Actions-2:
|
|
name: "Explore Gitea Actions - 2"
|
|
if: ${{ github.ref == 'refs/heads/main' }} # skip
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Info
|
|
run: |
|
|
echo "Triggered by ${{ gitea.event_name }} event"
|
|
echo "Branch: ${{ gitea.ref }}"
|
|
echo "Repository: ${{ gitea.repository }}"
|
|
|
|
- name: Install Node.js, npm, and Yarn (optimized)
|
|
run: |
|
|
set -e
|
|
echo "Preparing Node.js, npm, and Yarn setup..."
|
|
|
|
if command -v apt >/dev/null 2>&1; then
|
|
echo "→ Using apt (Debian/Ubuntu)..."
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq >/dev/null
|
|
apt-get install -y -qq curl ca-certificates >/dev/null
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - >/dev/null 2>&1
|
|
apt-get install -y -qq nodejs >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
elif command -v apk >/dev/null 2>&1; then
|
|
echo "→ Using apk (Alpine)..."
|
|
apk add --no-cache curl nodejs npm >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
elif command -v dnf >/dev/null 2>&1; then
|
|
echo "→ Using dnf (Fedora/RHEL)..."
|
|
dnf install -y -q curl ca-certificates nodejs npm >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
else
|
|
echo "No supported package manager found (apt, apk, dnf)."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Node.js, npm, and Yarn installed successfully:"
|
|
node -v
|
|
npm -v
|
|
yarn -v
|
|
|
|
- name: Checkout repository manually
|
|
env:
|
|
TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
CLONE_URL: ${{ vars.CLONE_URL }}
|
|
run: |
|
|
echo "Cloning from $CLONE_URL"
|
|
echo "Cloning ALL_REPO_TOKEN $ALL_REPO_TOKEN"
|
|
CLONE_URL_WITH_AUTH=$(echo "$CLONE_URL" | sed "s#https://#https://$ALL_REPO_TOKEN@#")
|
|
git clone --quiet "$CLONE_URL_WITH_AUTH" .
|
|
echo "${{ gitea.repository }} cloned successfully."
|
|
|
|
- name: List repo files
|
|
run: |
|
|
ls .
|
|
node -v
|
|
npm -v
|
|
yarn -v
|
|
|
|
- name: Done
|
|
run: echo "Workflow finished."
|
|
|
|
#blish-backend-docker-image:
|
|
#name: Build and publish backend Docker image to server
|
|
#runs-on: ubuntu-latest
|
|
#needs: backend-jobs
|
|
#steps:
|
|
# - name: Checkout repository
|
|
# uses: actions/checkout@v4
|
|
#
|
|
# - name: Set up Docker
|
|
# run: |
|
|
# apt-get update -y
|
|
# apt-get install -y docker.io
|
|
#
|
|
# - name: Build Docker image
|
|
# run: |
|
|
# docker build -t backend-app:latest .
|
|
#
|
|
# - name: Save Docker image as tarball
|
|
# run: docker save backend-app:latest -o backend-app.tar
|
|
#
|
|
# - name: Copy Docker image to remote server and load it
|
|
# env:
|
|
# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
# SERVER_IP: <ip>
|
|
# run: |
|
|
# mkdir -p ~/.ssh
|
|
# echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
# chmod 600 ~/.ssh/id_rsa
|
|
# scp -o StrictHostKeyChecking=no backend-app.tar root@$SERVER_IP:/tmp/backend-app.tar
|
|
# ssh -o StrictHostKeyChecking=no root@$SERVER_IP "
|
|
# docker load -i /tmp/backend-app.tar &&
|
|
# docker tag backend-app:latest backend-app:latest &&
|
|
# echo 'Backend Docker image loaded successfully'
|
|
# "
|