Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanChao authored Sep 19, 2021
2 parents 3c797bf + 830dbcf commit 5a6e07c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,15 @@ jobs:
kill %1
make redis_stop
release:
github-release:
name: GitHub Releases
runs-on: ubuntu-latest
needs:
- style
- test
needs: [style, test]
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions-rs/cargo@v1
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
Expand All @@ -87,3 +86,44 @@ jobs:
allowUpdates: true
artifacts: "target/release/mirror-cache"
token: ${{ secrets.GITHUB_TOKEN }}

docker-release:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: [style, test]
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: seanchao/mirror-cache

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

crates-release:
name: Publish on crates.io
runs-on: ubuntu-latest
needs: [style, test]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mirror-cache"
version = "0.0.1"
version = "0.0.3"
authors = ["SeanChao <[email protected]>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN apt-get install -y openssl ca-certificates
RUN update-ca-certificates

# Copy from the previous build
COPY --from=build /mirror-cache/target/release/mirror-cache /app/mirror-cache
COPY --from=build /mirror-cache/target/release/mirror-cache /bin/mirror-cache
WORKDIR /app/
# Run the binary
CMD ["/app/mirror-cache"]
CMD ["mirror-cache"]
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod task;
mod util;

use cache::CacheHitMiss;
use clap::{App, Arg};
use clap::{crate_version, App, Arg};
use metrics::{increment_counter, register_counter};
use metrics_exporter_prometheus::PrometheusBuilder;
use metrics_util::MetricKindMask;
Expand Down Expand Up @@ -47,6 +47,7 @@ lazy_static::lazy_static! {
#[tokio::main]
async fn main() {
let matches = App::new("mirror-cache")
.version(crate_version!())
.arg(
Arg::with_name("config")
.short("c")
Expand Down

0 comments on commit 5a6e07c

Please sign in to comment.