diff --git a/.gitea/workflows/demo2.yaml b/.gitea/workflows/demo2.yaml index 606a281..7b6ee21 100644 --- a/.gitea/workflows/demo2.yaml +++ b/.gitea/workflows/demo2.yaml @@ -1,19 +1,71 @@ name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions -on: [push] + +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: - Explore-Gitea-Actions: + Explore-Gitea-Actions-2: runs-on: ubuntu-latest 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 - 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: List files in the repository + - name: Info run: | - ls ${{ gitea.workspace }} - - run: echo "This job's status is ${{ job.status }}." \ No newline at end of file + 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 "$CLONE_URL_WITH_AUTH" . + + - name: List repo files and dependencies versions + run: | + ls . + + - name: Done + run: echo "Workflow finished."