Merge pull request 'Add all files for first release 1.0.0' (#1) from develop into main
Reviewed-on: #1
This commit is contained in:
commit
248aa47927
52
.gitea/workflows/build-develop.yaml
Normal file
52
.gitea/workflows/build-develop.yaml
Normal file
@ -0,0 +1,52 @@
|
||||
name: Build Develop Image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
|
||||
env:
|
||||
FULL_TAG: git.mrmeeb.stream/mrmeeb/pywebfinger:develop
|
||||
|
||||
jobs:
|
||||
"Build Image":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mrmeeb.stream
|
||||
username: ${{ env.GITHUB_ACTOR }}
|
||||
password: ${{ secrets.GTCR_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ env.FULL_TAG }}
|
||||
provenance: false
|
||||
- name: Notify on failure
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: failure()
|
||||
with:
|
||||
severity: error
|
||||
details: Build failed!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
||||
"Notify":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
needs: ["Build Image"]
|
||||
steps:
|
||||
- name: Notify of success
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: success()
|
||||
with:
|
||||
severity: info
|
||||
details: Build succeeded!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
52
.gitea/workflows/build-main.yaml
Normal file
52
.gitea/workflows/build-main.yaml
Normal file
@ -0,0 +1,52 @@
|
||||
name: Build Main Image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
env:
|
||||
FULL_TAG: git.mrmeeb.stream/mrmeeb/pywebfinger:latest
|
||||
|
||||
jobs:
|
||||
"Build Image":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mrmeeb.stream
|
||||
username: ${{ env.GITHUB_ACTOR }}
|
||||
password: ${{ secrets.GTCR_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ env.FULL_TAG }}
|
||||
provenance: false
|
||||
- name: Notify on failure
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: failure()
|
||||
with:
|
||||
severity: error
|
||||
details: Build failed!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
||||
"Notify":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
needs: ["Build Image"]
|
||||
steps:
|
||||
- name: Notify of success
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: success()
|
||||
with:
|
||||
severity: info
|
||||
details: Build succeeded!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
77
.gitea/workflows/build-tagged-release.yaml
Normal file
77
.gitea/workflows/build-tagged-release.yaml
Normal file
@ -0,0 +1,77 @@
|
||||
name: Build Tagged Release Image
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
FULL_TAG: git.mrmeeb.stream/mrmeeb/pywebfinger
|
||||
|
||||
jobs:
|
||||
"Build Image":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mrmeeb.stream
|
||||
username: ${{ env.GITHUB_ACTOR }}
|
||||
password: ${{ secrets.GTCR_TOKEN }}
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${FULL_TAG}
|
||||
tags: |
|
||||
type=pep440,pattern={{version}}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
provenance: false
|
||||
- name: Notify on failure
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: failure()
|
||||
with:
|
||||
severity: error
|
||||
details: Build failed!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
||||
"Create Release":
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean -f .goreleaser-gitea.yaml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
"Notify":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
needs: ["Build Image"]
|
||||
steps:
|
||||
- name: Notify of success
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: success()
|
||||
with:
|
||||
severity: info
|
||||
details: Build succeeded!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
47
.gitea/workflows/test-pr.yaml
Normal file
47
.gitea/workflows/test-pr.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
name: Test Pull Request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'develop'
|
||||
|
||||
env:
|
||||
FULL_TAG: git.mrmeeb.stream/mrmeeb/pywebfinger:develop
|
||||
|
||||
jobs:
|
||||
"Build Image":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: false
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ env.FULL_TAG }}
|
||||
provenance: false
|
||||
- name: Notify on failure
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: failure()
|
||||
with:
|
||||
severity: error
|
||||
details: Build failed!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
||||
"Notify":
|
||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||
needs: ["Build Image"]
|
||||
steps:
|
||||
- name: Notify of success
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
if: success()
|
||||
with:
|
||||
severity: info
|
||||
details: Build succeeded!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
username: Gitea
|
||||
avatarUrl: ${{ vars.RUNNER_ICON_URL }}
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM python:3.13.0a6-alpine3.19
|
||||
|
||||
RUN apk add curl
|
||||
|
||||
ENV ISSUER_URL=
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY webfinger.py /webfinger.py
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=15s --start-period=30s --retries=3 CMD curl -f http://localhost:8000/healthcheck || exit 1
|
||||
|
||||
CMD [ "python", "-u", "/webfinger.py" ]
|
34
goreleaser-gitea.yaml
Normal file
34
goreleaser-gitea.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
dist: dist-gitea
|
||||
|
||||
builds:
|
||||
skip: true
|
||||
|
||||
archives:
|
||||
- format: binary
|
||||
|
||||
release:
|
||||
draft: true
|
||||
|
||||
header: |
|
||||
# PyWebfinger v{{ .Tag }}
|
||||
|
||||
## Docker Image:
|
||||
`git.mrmeeb.stream/mrmeeb/pywebfinger:{{ .Tag }}`
|
||||
|
||||
gitea:
|
||||
owner: MrMeeb
|
||||
name: pywebfinger
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
|
||||
# .goreleaser.yaml
|
||||
gitea_urls:
|
||||
api: https://git.mrmeeb.stream/api/v1
|
||||
download: https://git.mrmeeb.stream
|
||||
# set to true if you use a self-signed certificate
|
||||
skip_tls_verify: false
|
7
renovate.json
Normal file
7
renovate.json
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
{
|
||||
"extends": [":automergeMinor", ":automergePr", ":automergeRequireAllStatusChecks", ":dependencyDashboard", ":disableRateLimiting", ":rebaseStalePrs"],
|
||||
"major": {
|
||||
"dependencyDashboardApproval": true
|
||||
}
|
||||
}
|
72
webfinger.py
Normal file
72
webfinger.py
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
import json
|
||||
import os
|
||||
|
||||
class WebFingerHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
if self.path.startswith('/.well-known/webfinger'):
|
||||
parsed_url = urlparse(self.path)
|
||||
query_params = parse_qs(parsed_url.query)
|
||||
|
||||
if 'resource' in query_params:
|
||||
resource = query_params['resource'][0]
|
||||
|
||||
if resource.startswith('acct:'):
|
||||
email = resource[5:]
|
||||
issuer_url = os.environ["ISSUER_URL"]
|
||||
response_data = {
|
||||
"subject": resource,
|
||||
"links": [
|
||||
{
|
||||
"rel": "http://openid.net/specs/connect/1.0/issuer",
|
||||
"href": issuer_url
|
||||
},
|
||||
{
|
||||
"rel": "authorization_endpoint",
|
||||
"href": issuer_url + "oauth2/authorize"
|
||||
},
|
||||
{
|
||||
"rel": "token_endpoint",
|
||||
"href": issuer_url + "oauth2/token"
|
||||
},
|
||||
{
|
||||
"rel": "userinfo_endpoint",
|
||||
"href": issuer_url + "userinfo"
|
||||
},
|
||||
{
|
||||
"rel": "jwks_uri",
|
||||
"href": issuer_url + "jwks"
|
||||
}
|
||||
]
|
||||
}
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "application/json")
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(response_data).encode())
|
||||
return
|
||||
|
||||
if self.path.startswith('/health'):
|
||||
self.send_response(200)
|
||||
response_data = {
|
||||
"health": "ok"
|
||||
}
|
||||
self.send_header("Content-type", "application/json")
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(response_data).encode())
|
||||
return
|
||||
|
||||
self.send_response(404)
|
||||
self.end_headers()
|
||||
self.wfile.write(b"Resource not found")
|
||||
|
||||
def run_server(server_class=HTTPServer, handler_class=WebFingerHandler, port=8000):
|
||||
server_address = ('', port)
|
||||
httpd = server_class(server_address, handler_class)
|
||||
print("Issuer URL is " + os.environ["ISSUER_URL"])
|
||||
print(f"Starting WebFinger server on port {port}")
|
||||
httpd.serve_forever()
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_server()
|
Loading…
x
Reference in New Issue
Block a user