33 lines
1.3 KiB
YAML
33 lines
1.3 KiB
YAML
on: [push, pull_request]
|
|
|
|
name: Continuous integration
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://gitea.com/actions/checkout@v4
|
|
- uses: https://git.airpig.cn/actions/setup-rust-toolchain@v1
|
|
- run: |
|
|
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
|
sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
|
apt update && apt install -y musl-tools
|
|
rustup target add x86_64-unknown-linux-musl
|
|
cargo build -r --target x86_64-unknown-linux-musl
|
|
- name: Login to hub.airpig.cn
|
|
uses: https://gitea.com/docker/login-action@v3
|
|
with:
|
|
registry: hub.airpig.cn
|
|
username: admin
|
|
password: Chenweijia113!
|
|
- run: |
|
|
ls
|
|
var=${{ gitea.repository }}
|
|
repo=${var##*/}
|
|
version=$(grep -oP '(?<=version = ")(.*)(?=")' "Cargo.toml")
|
|
new_version="v${version}"
|
|
docker build -t hub.airpig.cn/library/$repo:$new_version .
|
|
docker push hub.airpig.cn/library/$repo:$new_version
|
|
docker rmi hub.airpig.cn/library/$repo:$new_version
|
|
- run: echo "This job's status is ${{ job.status }}. |