Skip to content

Commit

Permalink
Add: ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pchpub authored Dec 5, 2023
1 parent 5672bed commit 6f5e353
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: ci

on:
push:
branches:
- '*'
tags:
- 'v*.*.*'
paths-ignore:
- '**.md'
- 'LICENSE'
- 'config.example.**'
- '**.sh'
- '**.json'
- '**.yml'
- '!.github/workflows/**'
jobs:
check:
name: Review the code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check
run: cargo check
build:
name: Build the binary file
if: ${{ github.event_name != 'pull_request' && success() }}
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Build
run: |
docker run -i --rm \
-v $PWD:/workdir \
-v ~/.cargo/git:/root/.cargo/git \
-v ~/.cargo/registry:/root/.cargo/registry \
registry.gitlab.com/rust_musl_docker/image:stable-latest \
cargo build --profile=fast -vv --target=x86_64-unknown-linux-musl
- name: Upload Build Artifact
uses: actions/[email protected]
with:
name: ddns-rust-${{ github.run_number }}
path: |
./target/x86_64-unknown-linux-musl/fast/ddns-rust
alpha:
name: Upload the Alpha test version file
permissions: write-all
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ddns-rust-${{ github.run_number }}
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: alpha-releases
assets: |
ddns-rust
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: alpha-releases
files: |
./ddns-rust
release:
name: Upload the binary file when it is released
permissions: write-all
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ddns-rust-${{ github.run_number }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./ddns-rust

0 comments on commit 6f5e353

Please sign in to comment.