add auto release script

Signed-off-by: Yang Keao <keao.yang@yahoo.com>
This commit is contained in:
Yang Keao 2020-09-10 12:06:10 +08:00
parent 23eb90d8e9
commit 1a16dde822
4 changed files with 63 additions and 12 deletions

View File

@ -1,3 +1,4 @@
target
.git
Dockerfile
Dockerfile
example

40
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,40 @@
on:
push:
tags:
- 'v*'
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
make image-toda
CID=$(docker create <image-name>)
docker cp ${CID}:/toda /toda
tar -czvf /toda.tar.gz /toda
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /toda.tar.gz
asset_name: toda-linux-amd64.tar.gz
asset_content_type: application/zip

View File

@ -1,26 +1,33 @@
# syntax=docker/dockerfile:experimental
FROM ubuntu:20.04
FROM debian:buster-slim
ENV DEBIAN_FRONTEND noninteractive
ARG HTTPS_PROXY
ARG HTTP_PROXY
ENV DEBIAN_FRONTEND noninteractive
ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
RUN apt-get update
RUN apt-get install libfuse-dev pkg-config fuse curl build-essential -y
RUN apt-get install gdb vim -y
RUN apt-get update && apt-get install build-essential curl git pkg-config libfuse-dev fuse -y && rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly-2020-07-01 -y
ENV PATH "/root/.cargo/bin:${PATH}"
ENV RUSTFLAGS "-Z relro-level=full"
RUN if [ -n "$HTTP_PROXY" ]; then echo "[http]\n\
proxy = \"${HTTP_PROXY}\"\n\
"\
> /root/.cargo/config ; fi
COPY . /toda-build
WORKDIR /toda-build
COPY . .
ENV RUSTFLAGS "-Z relro-level=full"
RUN --mount=type=cache,target=/toda-build/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo build --release
RUN --mount=type=cache,target=/toda-build/target \
cargo build
RUN --mount=type=cache,target=/toda-build/target \
cp /toda-build/target/debug/toda /toda
cp /toda-build/target/release/toda /toda

View File

@ -10,5 +10,8 @@ example: example-image volume
example-inject:debug-toda
cat ./io-inject-example.json|sudo -E ./target/debug/toda --path /var/run/test --pid $$(pgrep main-app) --verbose trace
image-toda:
docker build --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg HTTPS_PROXY=${HTTPS_PROXY} . -t chaos-mesh/toda
debug-toda:
RUSTFLAGS="-Z relro-level=full" cargo build