Compare commits
2 Commits
1ae54a46e7
..
v1.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 945574906b | |||
| ee10a0f35a |
@@ -0,0 +1,60 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'v')
|
||||
runs-on: build-htz-01
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract Version
|
||||
id: get_version
|
||||
run: echo "VERSION=${{ github.head_ref }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
uses: https://github.com/metcalfc/changelog-generator@v4.6.2
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
docker build -t cr.jdbnet.co.uk/public/opnsense-sftp:$VERSION \
|
||||
-t cr.jdbnet.co.uk/public/opnsense-sftp:latest \
|
||||
--build-arg VERSION=$VERSION \
|
||||
.
|
||||
docker push cr.jdbnet.co.uk/public/opnsense-sftp:$VERSION
|
||||
docker push cr.jdbnet.co.uk/public/opnsense-sftp:latest
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: ${{ steps.get_version.outputs.VERSION }}
|
||||
name: ${{ steps.get_version.outputs.VERSION }}
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
deploy:
|
||||
name: Deploy to Kubernetes
|
||||
needs: release
|
||||
runs-on: k3s-internal-htz-01
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
run: |
|
||||
sudo kubectl replace -f deployment.yml --grace-period=60 --force
|
||||
@@ -1,73 +0,0 @@
|
||||
name: Release Please
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
steps:
|
||||
- uses: googleapis/release-please-action@v4
|
||||
id: release
|
||||
with:
|
||||
manifest-file: .release-please-manifest.json
|
||||
config-file: .release-please-config.json
|
||||
|
||||
- name: Checkout
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Read version
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(cat VERSION)
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push Docker image
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/jdb-net/opnsense-sftp:${{ env.VERSION }}
|
||||
ghcr.io/jdb-net/opnsense-sftp:latest
|
||||
build-args: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
|
||||
deploy:
|
||||
name: Deploy to Kubernetes
|
||||
needs: release-please
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
runs-on: [ k3s-internal-htz-01 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Apply manifests
|
||||
run: |
|
||||
sudo kubectl replace -f deployment.yml --grace-period=60 --force
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"packages": {
|
||||
".": {
|
||||
"release-type": "simple",
|
||||
"version-file": "VERSION"
|
||||
}
|
||||
},
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
".": "1.2.0"
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## [1.2.0](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.2...v1.2.0) (2025-11-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* :sparkles: latest backup api endpoint - /api/backups/latest ([703ab3b](https://github.com/JDB-NET/opnsense-sftp/commit/703ab3b07da0b60f91d674fd6f4a39d3c45ae1e6))
|
||||
|
||||
## [1.1.2](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.1...v1.1.2) (2025-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: k3s character limit ([2b91c19](https://github.com/JDB-NET/opnsense-sftp/commit/2b91c19afbf95f9192b43b46ebdc7816bb407db9))
|
||||
|
||||
## [1.1.1](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.0...v1.1.1) (2025-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: allow writing packages ([dbdeacd](https://github.com/JDB-NET/opnsense-sftp/commit/dbdeacdf7de133a0db4c44c13828458ff08a028a))
|
||||
|
||||
## [1.1.0](https://github.com/JDB-NET/opnsense-sftp/compare/v1.0.0...v1.1.0) (2025-11-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* :sparkles: initial commit ([07fc785](https://github.com/JDB-NET/opnsense-sftp/commit/07fc78592bc83e500ae0f3312d8a7bae9b0bf1f9))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: public host ip ([6dd09cf](https://github.com/JDB-NET/opnsense-sftp/commit/6dd09cf147f7a20856af1cfa68390586f6acc2e5))
|
||||
* :bug: release please config ([89e1231](https://github.com/JDB-NET/opnsense-sftp/commit/89e12315fe69a64849068645048b01c871165532))
|
||||
+3
-5
@@ -1,11 +1,9 @@
|
||||
FROM python:3.13-slim
|
||||
LABEL org.opencontainers.image.vendor="JDB-NET"
|
||||
WORKDIR /app
|
||||
|
||||
# Build argument for version
|
||||
ARG VERSION=dev
|
||||
ENV APP_VERSION=${VERSION}
|
||||
|
||||
COPY . /app
|
||||
ARG VERSION=unknown
|
||||
ENV APP_VERSION=${VERSION}
|
||||
RUN pip install -r requirements.txt \
|
||||
&& apt-get update \
|
||||
&& apt-get install curl -y \
|
||||
|
||||
@@ -36,17 +36,15 @@ docker run -d \
|
||||
-e SFTP_PUBLIC_PORT=30222 \
|
||||
-v /path/to/keys:/app/keys \
|
||||
-v /path/to/backups:/app/backups \
|
||||
ghcr.io/jdb-net/opnsense-sftp:latest
|
||||
cr.jdbnet.co.uk/public/opnsense-sftp:latest
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
|
||||
```yaml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
opnsense-sftp:
|
||||
image: ghcr.io/jdb-net/opnsense-sftp:latest
|
||||
image: cr.jdbnet.co.uk/public/opnsense-sftp:latest
|
||||
container_name: opnsense-sftp
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
|
||||
@@ -22,22 +22,8 @@ load_dotenv()
|
||||
setup_logging()
|
||||
logger = get_logger(__name__)
|
||||
|
||||
# Read version from VERSION file or environment
|
||||
def get_version():
|
||||
"""Get application version from VERSION file or environment variable."""
|
||||
# Check environment variable first (set during Docker build)
|
||||
env_version = os.getenv('APP_VERSION')
|
||||
if env_version and env_version != 'dev':
|
||||
return env_version
|
||||
|
||||
# Fall back to VERSION file
|
||||
try:
|
||||
version_path = Path(__file__).parent / 'VERSION'
|
||||
if version_path.exists():
|
||||
return version_path.read_text().strip()
|
||||
except Exception:
|
||||
pass
|
||||
return 'dev'
|
||||
return os.getenv('APP_VERSION', 'dev')
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = os.getenv('SECRET_KEY', 'change-this-secret-key-in-production')
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: opnsense-sftp
|
||||
image: ghcr.io/jdb-net/opnsense-sftp:latest
|
||||
image: cr.jdbnet.co.uk/public/opnsense-sftp:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@
|
||||
<p class="text-center text-neutral-400 text-sm">
|
||||
OPNsense Backup Manager
|
||||
{% if version %}
|
||||
<span class="text-neutral-500">v{{ version }}</span>
|
||||
<span class="text-neutral-500">{{ version }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user