Add actions, remove drone
This commit is contained in:
parent
b365973fd2
commit
f8bce4af7f
421
.drone.yml
421
.drone.yml
|
@ -1,421 +0,0 @@
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: clippy
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: clippy
|
|
||||||
image: asonix/rust-builder:latest-linux-amd64
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- rustup component add clippy
|
|
||||||
- cargo clippy -- -D warnings
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: tests
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: tests
|
|
||||||
image: asonix/rust-builder:latest-linux-amd64
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo test
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: check-amd64
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: check
|
|
||||||
image: asonix/rust-builder:latest-linux-amd64
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo check --target=$TARGET
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build-amd64
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: asonix/rust-builder:latest-linux-amd64
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo build --target=$TARGET --release
|
|
||||||
- $TOOL-strip target/$TARGET/release/fursonabot
|
|
||||||
- cp target/$TARGET/release/fursonabot .
|
|
||||||
- cp fursonabot fursonabot-linux-amd64
|
|
||||||
|
|
||||||
- name: push
|
|
||||||
image: plugins/docker:20
|
|
||||||
settings:
|
|
||||||
username: asonix
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_token
|
|
||||||
repo: asonix/fursonabot
|
|
||||||
dockerfile: docker/drone/Dockerfile
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-amd64
|
|
||||||
build_args:
|
|
||||||
- REPO_ARCH=amd64
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: plugins/gitea-release:1
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
base_url: https://git.asonix.dog
|
|
||||||
files:
|
|
||||||
- fursonabot-linux-amd64
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- clippy
|
|
||||||
- tests
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: check-arm64v8
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: check
|
|
||||||
image: asonix/rust-builder:latest-linux-arm64v8
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo check --target=$TARGET
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build-arm64v8
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: asonix/rust-builder:latest-linux-arm64v8
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo build --target=$TARGET --release
|
|
||||||
- $TOOL-strip target/$TARGET/release/fursonabot
|
|
||||||
- cp target/$TARGET/release/fursonabot .
|
|
||||||
- cp fursonabot fursonabot-linux-arm64v8
|
|
||||||
|
|
||||||
- name: push
|
|
||||||
image: plugins/docker:20
|
|
||||||
settings:
|
|
||||||
username: asonix
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_token
|
|
||||||
repo: asonix/fursonabot
|
|
||||||
dockerfile: docker/drone/Dockerfile
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-arm64v8
|
|
||||||
build_args:
|
|
||||||
- REPO_ARCH=arm64v8
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: plugins/gitea-release:1
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
base_url: https://git.asonix.dog
|
|
||||||
files:
|
|
||||||
- fursonabot-linux-arm64v8
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- clippy
|
|
||||||
- tests
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: check-arm32v7
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: check
|
|
||||||
image: asonix/rust-builder:latest-linux-arm32v7
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo check --target=$TARGET
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build-arm32v7
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: asonix/rust-builder:latest-linux-arm32v7
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- cargo build --target=$TARGET --release
|
|
||||||
- $TOOL-strip target/$TARGET/release/fursonabot
|
|
||||||
- cp target/$TARGET/release/fursonabot .
|
|
||||||
- cp fursonabot fursonabot-linux-arm32v7
|
|
||||||
|
|
||||||
- name: push
|
|
||||||
image: plugins/docker:20
|
|
||||||
settings:
|
|
||||||
username: asonix
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_token
|
|
||||||
repo: asonix/fursonabot
|
|
||||||
dockerfile: docker/drone/Dockerfile
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: linux-arm32v7
|
|
||||||
build_args:
|
|
||||||
- REPO_ARCH=arm32v7
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: plugins/gitea-release:1
|
|
||||||
settings:
|
|
||||||
api_key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
base_url: https://git.asonix.dog
|
|
||||||
files:
|
|
||||||
- fursonabot-linux-arm32v7
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- clippy
|
|
||||||
- tests
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: manifest
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: manifest
|
|
||||||
image: plugins/manifest:1
|
|
||||||
settings:
|
|
||||||
username: asonix
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub_token
|
|
||||||
dump: true
|
|
||||||
auto_tag: true
|
|
||||||
ignore_missing: true
|
|
||||||
spec: docker/drone/manifest.tmpl
|
|
||||||
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build-amd64
|
|
||||||
- build-arm64v8
|
|
||||||
- build-arm32v7
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: publish-crate
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clone
|
|
||||||
image: alpine/git:latest
|
|
||||||
user: root
|
|
||||||
commands:
|
|
||||||
- git clone $DRONE_GIT_HTTP_URL .
|
|
||||||
- git checkout $DRONE_COMMIT
|
|
||||||
- chown -R 991:991 .
|
|
||||||
|
|
||||||
- name: publish
|
|
||||||
image: asonix/rust-builder:latest-linux-amd64
|
|
||||||
pull: always
|
|
||||||
environment:
|
|
||||||
CRATES_IO_TOKEN:
|
|
||||||
from_secret: crates_io_token
|
|
||||||
commands:
|
|
||||||
- cargo publish --token $CRATES_IO_TOKEN
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build-amd64
|
|
||||||
- build-arm64v8
|
|
||||||
- build-arm32v7
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- tag
|
|
61
.forgejo/workflows/check.yaml
Normal file
61
.forgejo/workflows/check.yaml
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Clippy
|
||||||
|
run: |
|
||||||
|
cargo clippy --no-default-features -- -D warnings
|
||||||
|
|
||||||
|
tests:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Test
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
check:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- x86_64-unknown-linux-musl
|
||||||
|
- armv7-unknown-linux-musleabihf
|
||||||
|
- aarch64-unknown-linux-musl
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Debug builds
|
||||||
|
run: cargo zigbuild --target ${{ matrix.target }}
|
226
.forgejo/workflows/publish.yaml
Normal file
226
.forgejo/workflows/publish.yaml
Normal file
|
@ -0,0 +1,226 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY_IMAGE: asonix/fursonabot
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy:
|
||||||
|
runs-on: base-image
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Clippy
|
||||||
|
run: |
|
||||||
|
cargo clippy --no-default-features -- -D warnings
|
||||||
|
|
||||||
|
tests:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Test
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs:
|
||||||
|
- clippy
|
||||||
|
- tests
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
info:
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
artifact: linux-amd64
|
||||||
|
platform: linux/amd64
|
||||||
|
- target: armv7-unknown-linux-musleabihf
|
||||||
|
artifact: linux-arm32v7
|
||||||
|
platform: linux/arm/v7
|
||||||
|
- target: aarch64-unknown-linux-musl
|
||||||
|
artifact: linux-arm64v8
|
||||||
|
platform: linux/arm64
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Prepare Platform
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.info.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY_IMAGE }}
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
suffix=-${{ matrix.info.artifact }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{ is_default_branch }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: https://github.com/docker/setup-qemu-action@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
-
|
||||||
|
name: Docker login
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Compile fursonabot
|
||||||
|
run: cargo zigbuild --target ${{ matrix.info.target }} --release
|
||||||
|
-
|
||||||
|
name: Prepare artifacts
|
||||||
|
run: |
|
||||||
|
mkdir artifacts
|
||||||
|
cp target/${{ matrix.info.target }}/release/fursonabot artifacts/fursonabot-${{ matrix.info.artifact }}
|
||||||
|
-
|
||||||
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: binaries
|
||||||
|
path: artifacts/
|
||||||
|
-
|
||||||
|
name: Prepare binary
|
||||||
|
run: |
|
||||||
|
cp target/${{ matrix.info.target }}/release/fursonabot docker/forgejo/fursonabot
|
||||||
|
-
|
||||||
|
name: Build and push ${{ matrix.info.platform }} docker image
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./docker/forgejo
|
||||||
|
platforms: ${{ matrix.info.platform }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},name-canonical=true,push=true
|
||||||
|
-
|
||||||
|
name: Export digest
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
echo "Created /tmp/digests/${digest#sha256:}"
|
||||||
|
shell: bash
|
||||||
|
-
|
||||||
|
name: Upload ${{ matrix.info.platform }} digest
|
||||||
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: digests
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
publish-docker:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
needs: [build]
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Download digests
|
||||||
|
uses: https://github.com/actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: digests
|
||||||
|
path: /tmp/digests
|
||||||
|
pattern: digests-*
|
||||||
|
merge-multiple: true
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
-
|
||||||
|
name: Docker login
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY_IMAGE }}
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{ is_default_branch }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
-
|
||||||
|
name: Create manifest list and push
|
||||||
|
working-directory: /tmp/digests
|
||||||
|
run: |
|
||||||
|
tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "${DOCKER_METADATA_OUTPUT_JSON}")
|
||||||
|
images=$(printf "${{ env.REGISTRY_IMAGE }}@sha256:%s " *)
|
||||||
|
echo "Running 'docker buildx imagetools create ${tags[@]} ${images[@]}'"
|
||||||
|
docker buildx imagetools create ${tags[@]} ${images[@]}
|
||||||
|
shell: bash
|
||||||
|
-
|
||||||
|
name: Inspect Image
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
||||||
|
|
||||||
|
publish-forgejo:
|
||||||
|
needs: [build]
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: binaries
|
||||||
|
path: artifacts/
|
||||||
|
merge-multiple: true
|
||||||
|
- uses: actions/forgejo-release@v1
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
release-dir: artifacts/
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
|
publish-crate:
|
||||||
|
needs: [build]
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/asonix/actions-base-image:0.1
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout fursonabot
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Cargo Cache
|
||||||
|
uses: https://git.asonix.dog/asonix/actions/cache-rust-dependencies@main
|
||||||
|
-
|
||||||
|
name: Publish Crate
|
||||||
|
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,6 @@
|
||||||
/target
|
/target
|
||||||
/Config.toml
|
/Config.toml
|
||||||
/sled
|
/sled
|
||||||
|
/.envrc
|
||||||
|
/.direnv
|
||||||
|
/result
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
ARG REPO_ARCH
|
|
||||||
|
|
||||||
FROM asonix/rust-runner:latest-linux-$REPO_ARCH
|
|
||||||
|
|
||||||
COPY fursonabot /usr/local/bin/fursonabot
|
|
||||||
|
|
||||||
USER app
|
|
||||||
VOLUME /opt/app
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
|
||||||
CMD ["/usr/local/bin/fursonabot"]
|
|
|
@ -1,25 +0,0 @@
|
||||||
image: asonix/fursonabot:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
|
||||||
{{#if build.tags}}
|
|
||||||
tags:
|
|
||||||
{{#each build.tags}}
|
|
||||||
- {{this}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
manifests:
|
|
||||||
-
|
|
||||||
image: asonix/fursonabot:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: linux
|
|
||||||
-
|
|
||||||
image: asonix/fursonabot:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64v8
|
|
||||||
platform:
|
|
||||||
architecture: arm64
|
|
||||||
os: linux
|
|
||||||
variant: v8
|
|
||||||
-
|
|
||||||
image: asonix/fursonabot:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm32v7
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v7
|
|
23
docker/forgejo/Dockerfile
Normal file
23
docker/forgejo/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
ARG UID=991
|
||||||
|
ARG GID=991
|
||||||
|
|
||||||
|
ENV \
|
||||||
|
UID=${UID} \
|
||||||
|
GID=${GID}
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN \
|
||||||
|
addgroup -g "${GID}" app && \
|
||||||
|
adduser -D -G app -u "${UID}" -g "" -h /opt/app app && \
|
||||||
|
apk add tini && \
|
||||||
|
chown -R app:app /mnt
|
||||||
|
|
||||||
|
COPY fursonabot /usr/local/bin/fursonabot
|
||||||
|
|
||||||
|
USER app
|
||||||
|
VOLUME /mnt
|
||||||
|
WORKDIR /mnt
|
||||||
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
CMD ["/usr/local/bin/fursonabot"]
|
61
flake.lock
Normal file
61
flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1705309234,
|
||||||
|
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1707546158,
|
||||||
|
"narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
34
flake.nix
Normal file
34
flake.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
description = "fursonabot";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = rec {
|
||||||
|
fursonabot = pkgs.callPackage ./fursonabot.nix { };
|
||||||
|
|
||||||
|
default = fursonabot;
|
||||||
|
};
|
||||||
|
|
||||||
|
apps = rec {
|
||||||
|
dev = flake-utils.lib.mkApp { drv = self.packages.${system}.fursonabot; };
|
||||||
|
default = dev;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShell = with pkgs; mkShell {
|
||||||
|
nativeBuildInputs = [ cargo cargo-outdated clippy gcc rust-analyzer rustc rustfmt ];
|
||||||
|
|
||||||
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
21
fursonabot.nix
Normal file
21
fursonabot.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib
|
||||||
|
, nixosTests
|
||||||
|
, rustPlatform
|
||||||
|
}:
|
||||||
|
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
pname = "fursonabot";
|
||||||
|
version = "0.2.3";
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ ];
|
||||||
|
|
||||||
|
passthru.tests = { inherit (nixosTests) fursonabot; };
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A simple image hosting service";
|
||||||
|
homepage = "https://git.asonix.dog/asonix/fursonabot";
|
||||||
|
license = with licenses; [ agpl3Plus ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue