Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc8c6b0dc6 | ||
|
|
7f2ea4f3b4 | ||
|
|
923b1e7c57 | ||
|
|
ee263d6224 |
+21
@@ -0,0 +1,21 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-push
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
steps:
|
||||
- name: build-and-push
|
||||
image: plugins/docker
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
registry: gitea.jambotron.com
|
||||
repo: gitea.jambotron.com/liosha84/htop-web
|
||||
auto_tag: true
|
||||
username:
|
||||
from_secret: REGISTRY_USERNAME
|
||||
password:
|
||||
from_secret: REGISTRY_PASSWORD
|
||||
@@ -1,50 +0,0 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.jambotron.com
|
||||
IMAGE_NAME: liosha84/htop-web
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: |
|
||||
# Remove 'v' prefix from tag (e.g., v0.1.0 → 0.1.0)
|
||||
VERSION=$(echo "${{ gitea.ref }}" | sed 's|refs/tags/v||')
|
||||
echo "version=${VERSION}" >> "${GITEA_OUTPUT}"
|
||||
|
||||
# Extract major.minor for minor tag (e.g., 0.1.0 → 0.1)
|
||||
MINOR=$(echo "${VERSION}" | sed 's/\.[0-9]*$//')
|
||||
echo "minor=${MINOR}" >> "${GITEA_OUTPUT}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.minor }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
+5
-1
@@ -6,9 +6,13 @@ This project follows [Semantic Versioning](https://semver.org/). For more detail
|
||||
|
||||
## Unreleased
|
||||
|
||||
## v0.3.0
|
||||
|
||||
- **CI/CD migrated to Drone** — replaced Gitea Actions with Drone CI/CD (`.drone.yml`). The Docker plugin `auto_tag` feature automatically creates Semantic Versioning tags (`0.3.0`, `0.3`) on Git tag pushes. Configure `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` secrets in the Gitea repository settings.
|
||||
|
||||
## v0.2.0
|
||||
|
||||
- **CI/CD with Gitea Actions** — automated Docker image build and push on Git tags. Each release produces three tags: full version (`0.2.0`), minor version (`0.2`), and `latest`. Configure `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` secrets in Gitea repository settings.
|
||||
- **CI/CD with Drone** — automated Docker image build and push on Git tags using Drone CI/CD. Each release produces three tags: full version (`0.2.0`), minor version (`0.2`), and `latest`. Configure `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` secrets in Gitea repository settings.
|
||||
- **Docker build optimization** — added `.dockerignore` to exclude unnecessary files from the build context, reducing build time and image size.
|
||||
- **Release documentation** — added detailed release process guide in `docs/DEVELOPMENT.md` with Semantic Versioning workflow.
|
||||
|
||||
|
||||
+24
-19
@@ -95,7 +95,7 @@ docker run -d \
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Gitea Actions runner must be configured and running.
|
||||
- Drone CI/CD runner must be configured and running.
|
||||
- Gitea Container Registry must be enabled on the server.
|
||||
- Repository secrets `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` must be set in the Gitea repository.
|
||||
|
||||
@@ -134,6 +134,26 @@ sudo systemctl restart gitea
|
||||
|
||||
**4. Verify** that the registry is working by visiting `https://gitea.jambotron.com/user/packages` — you should see a "Packages" tab.
|
||||
|
||||
### Configuring Drone CI/CD
|
||||
|
||||
The repository uses **Drone** for CI/CD. The configuration file `.drone.yml` is already included in the repository.
|
||||
|
||||
**1. Enable Drone for the repository.**
|
||||
|
||||
In Gitea, open the repository and go to **Settings → Drone**. Enable Drone CI/CD for the repository.
|
||||
|
||||
**2. Configure Drone secrets.**
|
||||
|
||||
In Gitea, open the repository and go to **Settings → Secrets** (or **Variables and Secrets → Secrets**). Add two secrets:
|
||||
|
||||
**First secret:**
|
||||
- **Name:** `REGISTRY_USERNAME`
|
||||
- **Value:** `Liosha84` (your Gitea username)
|
||||
|
||||
**Second secret:**
|
||||
- **Name:** `REGISTRY_PASSWORD`
|
||||
- **Value:** paste the Access Token with `write:package` and `read:package` scopes.
|
||||
|
||||
### Creating an Access Token for CI/CD
|
||||
|
||||
The CI/CD workflow cannot use your account password. You need a Personal Access Token with package permissions:
|
||||
@@ -150,21 +170,6 @@ The CI/CD workflow cannot use your account password. You need a Personal Access
|
||||
7. Click **Generate**.
|
||||
8. **Copy the token** — it will be shown only once! Save it securely.
|
||||
|
||||
### Configuring repository secrets
|
||||
|
||||
1. Open the repository: `https://gitea.jambotron.com/Liosha84/htop-web`.
|
||||
2. Go to **Settings** (tab at the top).
|
||||
3. In the left menu: **Secrets** (or **Variables and Secrets → Secrets**).
|
||||
4. Click **Add secret**.
|
||||
|
||||
**First secret:**
|
||||
- **Name:** `REGISTRY_USERNAME`
|
||||
- **Value:** `Liosha84` (your Gitea username)
|
||||
|
||||
**Second secret:**
|
||||
- **Name:** `REGISTRY_PASSWORD`
|
||||
- **Value:** paste the Access Token you created in the previous step.
|
||||
|
||||
### Creating a release
|
||||
|
||||
1. **Update `CHANGELOG.md`** with changes for the new version.
|
||||
@@ -184,10 +189,10 @@ The CI/CD workflow cannot use your account password. You need a Personal Access
|
||||
git push origin v0.2.0
|
||||
```
|
||||
|
||||
4. **Gitea Actions** will automatically:
|
||||
4. **Drone** will automatically:
|
||||
- Build the Docker image using the multi-stage Dockerfile
|
||||
- Tag it with the version (`0.2.0`), minor version (`0.2`), and `latest`
|
||||
- Push all three tags to the Gitea Container Registry
|
||||
- Auto-tag it using Semantic Versioning: `v0.2.0` produces tags `0.2`, `0.2.0`
|
||||
- Push all tags to the Gitea Container Registry
|
||||
|
||||
### Docker image tags
|
||||
|
||||
|
||||
Reference in New Issue
Block a user