Compare commits
4 commits
a3fd5f212e
...
3901db9f76
| Author | SHA1 | Date | |
|---|---|---|---|
| 3901db9f76 | |||
| 52a967e74b | |||
| 357ae736f4 | |||
| 696a5e5228 |
4 changed files with 4 additions and 38 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build, Push, and Release
|
name: Build and Push Docker Image to Forgejo Registry
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -33,8 +33,6 @@ jobs:
|
||||||
images: ${{ gitea.server_url }}/${{ gitea.repository }}
|
images: ${{ gitea.server_url }}/${{ gitea.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master' }}
|
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master' }}
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=sha,prefix=
|
type=sha,prefix=
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image
|
||||||
|
|
@ -46,35 +44,3 @@ jobs:
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
create-release:
|
|
||||||
needs: build-and-push
|
|
||||||
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Create Release in Forgejo
|
|
||||||
run: |
|
|
||||||
if [ "${{ startsWith(github.ref, 'refs/tags/v') }}" = "true" ]; then
|
|
||||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
|
||||||
RELEASE_NAME="Release ${TAG_NAME}"
|
|
||||||
else
|
|
||||||
TAG_NAME="v2.0.${{ github.run_number }}"
|
|
||||||
RELEASE_NAME="Phikipathia Release ${TAG_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Creating release ${RELEASE_NAME} with tag ${TAG_NAME}..."
|
|
||||||
|
|
||||||
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"tag_name\": \"${TAG_NAME}\",
|
|
||||||
\"target_commitish\": \"${{ github.sha }}\",
|
|
||||||
\"name\": \"${RELEASE_NAME}\",
|
|
||||||
\"body\": \"Phikipathia release for commit ${{ github.sha }}. Docker container images are published to the Forgejo Container Registry.\",
|
|
||||||
\"draft\": false,
|
|
||||||
\"prerelease\": false
|
|
||||||
}"
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ WORKDIR /app
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
PORT=8000 \
|
PORT=8000 \
|
||||||
USER_AGENT="Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia; tibo@depeuter.dev)"
|
USER_AGENT="Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia)"
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import requests
|
||||||
|
|
||||||
# Default HTTP User-Agent adhering to Wikimedia API policy
|
# Default HTTP User-Agent adhering to Wikimedia API policy
|
||||||
DEFAULT_USER_AGENT = (
|
DEFAULT_USER_AGENT = (
|
||||||
"Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia; tibo@depeuter.dev)"
|
"Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia; contact@phikipathia.org)"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Per-request HTTP timeout in seconds
|
# Per-request HTTP timeout in seconds
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ services:
|
||||||
- "${PORT:-8000}:8000"
|
- "${PORT:-8000}:8000"
|
||||||
environment:
|
environment:
|
||||||
- PORT=8000
|
- PORT=8000
|
||||||
- USER_AGENT=${USER_AGENT:-Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia; tibo@depeuter.dev)}
|
- USER_AGENT=${USER_AGENT:-Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia)}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://localhost:8000/\")'"]
|
test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://localhost:8000/\")'"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|
|
||||||
Reference in a new issue