1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/sourcehut-mirror-bridge synced 2024-12-21 22:32:19 +00:00

Compare commits

..

2 commits

Author SHA1 Message Date
Ash Keel
02fc03878d
add build pipeline
Some checks failed
continuous-integration/drone/push Build is failing
2023-11-13 14:20:13 +01:00
Ash Keel
7058bf90b2
MVP! 2023-11-13 14:15:11 +01:00
6 changed files with 73 additions and 5 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
target
LICENSE
README.md
.env

43
.drone.yml Normal file
View file

@ -0,0 +1,43 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: publish sha
image: banzaicloud/drone-kaniko
settings:
registry: registry.fromouter.space
repo: uchumoe/sourcehut-mirror-bridge
cache: true
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- latest
- ${DRONE_COMMIT_SHA}
when:
event:
- push
- name: publish tag
image: banzaicloud/drone-kaniko
settings:
registry: registry.fromouter.space
repo: uchumoe/sourcehut-mirror-bridge
cache: true
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- ${DRONE_COMMIT_BRANCH}
when:
event:
- tag
---
kind: signature
hmac: 925643c1816fd7df3823079bc98a79836e34e4641b8328ae0bc3eae37923ff84
...

5
.env
View file

@ -1,5 +0,0 @@
MIRROR_SOURCEHUT_TOKEN=AFTtM2cAAAAAAAAHYXNoa2VlbGD0EH1smnS5Nri8Mn+SZGLTE/oFX47id8EO09QlKCUV
MIRROR_GITEA_API_BASE=https://git.fromouter.space/api
MIRROR_GITEA_AUTH=hamcha:7159107dec5e558ebb0eea8a0a217589afd8c725
MIRROR_URL=https://eb87-79-40-140-240.ngrok.io
MIRROR_REPOSITORIES=test-webhook:Hamcha/strimertul-website

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
.env

20
Dockerfile Normal file
View file

@ -0,0 +1,20 @@
FROM public.ecr.aws/docker/library/rust:1-alpine as builder
RUN rustup default stable
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git
# Set `SYSROOT` to a dummy path (default is /usr) because pkg-config-rs *always*
# links those located in that path dynamically but we want static linking, c.f.
# https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L613
ENV SYSROOT=/dummy
WORKDIR /wd
COPY . /wd
RUN cargo build --release --target=x86_64-unknown-linux-musl
FROM public.ecr.aws/docker/library/alpine
ARG version=unknown
ARG release=unreleased
COPY --from=builder /wd/target/x86_64-unknown-linux-musl/release/sourcehut-mirror-bridge /usr/local/bin/
CMD ["sourcehut-mirror-bridge"]

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# sourcehut-mirror-bridge
SourceHut to Gitea active mirror bridge. Uses Soucehut GQL APIs to set up a webhook and manually sync a downstream Gitea/Forgejo repository set as a mirror.
Use case: You're running Drone CI or others linked to a Gitea instance and you want them to run as soon as possible.