dnstp/.gitea/workflows/build.yml

94 lines
2.4 KiB
YAML
Raw Normal View History

2024-07-19 20:32:40 +01:00
name: Build Binaries
on:
# Runs on pushes targeting the default branch
push:
jobs:
# Build job
build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
2024-07-28 11:17:02 +01:00
with:
2024-07-19 20:32:40 +01:00
github-server-url: https://gitea.sheep-ghoul.ts.net
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Cargo Test
uses: actions-rs/cargo@v1
with:
command: test
2024-07-28 10:45:40 +01:00
publishLib:
runs-on: ubuntu-latest
name: Package Library
needs: [ build ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
github-server-url: https://gitea.sheep-ghoul.ts.net
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2024-07-28 11:17:02 +01:00
- name: Add SarGit Repo
run: |
cat <<EOF > ~/.cargo/config.toml
[registry]
default = "sargit"
2024-07-28 12:30:46 +01:00
[registries.gitea]
index = "sparse+https://git.sarsoo.xyz/api/packages/${{ secrets.DOCKERHUB_USERNAME }}/cargo/" # Sparse index
# index = "https://git.sarsoo.xyz/sarsoo/_cargo-index.git" # Git
[net]
git-fetch-with-cli = true
2024-07-28 11:17:02 +01:00
EOF
2024-07-28 10:45:40 +01:00
- name: Cargo Publish
uses: actions-rs/cargo@v1
with:
command: publish
2024-07-28 12:43:07 +01:00
args: --token ${{ secrets.DOCKERHUB_TOKEN }} --package dnstplib
2024-07-28 10:45:40 +01:00
2024-07-19 20:32:40 +01:00
package:
runs-on: ubuntu-latest
name: Package Container
needs: [ build ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
2024-07-28 11:17:02 +01:00
with:
2024-07-19 20:32:40 +01:00
github-server-url: https://gitea.sheep-ghoul.ts.net
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: gitea.sheep-ghoul.ts.net
username: ${{ secrets.DOCKERHUB_USERNAME }}
2024-07-28 12:43:07 +01:00
password: ${{ secrets.DOCKERHUB_TOKEN }}
2024-07-19 20:32:40 +01:00
- name: Build & Push Container
uses: docker/build-push-action@v2
with:
push: true
tags: gitea.sheep-ghoul.ts.net/sarsoo/dnstp:latest
context: .