Nikola Derežić a249c599d9
All checks were successful
Build and Push Docker Image / check_version (push) Successful in 8s
Build and Push Docker Image / build (push) Has been skipped
(refactor) restructure workflow into two jobs with dependency
Split the workflow into separate check_version and build jobs using the needs keyword for job dependencies. This improves separation of concerns and makes the workflow structure more explicit.

Key changes:
- Created check_version job that outputs version_changed and version
- Build job now depends on check_version using needs keyword
- Build job uses version from check_version output (no re-reading)
- Added fetch-depth: 0 to ensure full git history for comparison
- Removed duplicate version reading step from build job
- Build conditional now uses needs.check_version.outputs.version_changed

Benefits:
- Clear separation between version checking and build logic
- Version is determined once and reused across jobs
- Better observability with separate job statuses in UI
- Enables potential reuse of version outputs by other jobs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-09 14:22:35 +01:00

Gitea Actions Demo Project

A simple Node.js "Hello World" application demonstrating Gitea Actions CI/CD pipeline with Docker build and push.

Project Structure

.
├── .gitea/
│   └── workflows/
│       └── build.yml          # Gitea Actions workflow
├── index.js                   # Main application
├── package.json               # Project configuration
├── Dockerfile                 # Docker image definition
├── .dockerignore              # Docker ignore file
└── README.md                  # This file

Application

The application is a simple Node.js script that prints "Hello World" to the console.

Running Locally

node index.js

Running with Docker

# Build the image
docker build -t gitea-actions-demo-project:1.0.0 .

# Run the container
docker run gitea-actions-demo-project:1.0.0

Gitea Actions CI/CD Pipeline

The project includes a Gitea Actions workflow that automatically:

  1. Triggers on push to master or main branches
  2. Checks out the code
  3. Reads the version from package.json
  4. Builds a Docker image
  5. Pushes the image to registry.budakova.org/knee-cola/gitea-actions-demo-project:<version>
  6. Also tags and pushes as latest

Workflow File

The workflow is defined in .gitea/workflows/build.yml

Registry Authentication

The workflow authenticates to the Docker registry using credentials configured in the repository settings:

  1. REGISTRY_USERNAME - Action variable defined in repository settings (Settings → Actions → Variables)
  2. REGISTRY_TOKEN - Action secret defined in repository settings (Settings → Actions → Secrets)

The REGISTRY_TOKEN should be a personal access token created in your Gitea user settings with the write:packages scope.

Image Naming

Images are pushed with two tags:

  • registry.budakova.org/knee-cola/gitea-actions-demo-project:<version-from-package.json>
  • registry.budakova.org/knee-cola/gitea-actions-demo-project:latest

Updating the Version

To change the version of your Docker image, simply update the version field in package.json. The next push to master/main will build and push the new version.

Testing the Workflow

  1. Make a change to the code or update the version in package.json
  2. Commit and push to master/main branch
  3. Check the Actions tab in your Gitea repository to see the workflow running
  4. Once complete, your Docker image will be available at the registry
Description
demo project which demonstrates how gitea actions work
Readme 58 KiB
Languages
Dockerfile 82.4%
JavaScript 17.6%