ci: add semantic-release

This commit is contained in:
Lucaskyy 2022-07-09 19:48:10 +02:00
parent 8afda248be
commit 85a93ac790
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89
2 changed files with 42 additions and 15 deletions

View File

@ -1,25 +1,14 @@
name: Rust
name: Release
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
branches: [main, dev]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
rust: [stable, nightly]
name: ${{ matrix.rust }}
runs-on: ubuntu-latest
steps:
@ -31,10 +20,15 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
toolchain: stable
override: true
components: clippy
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Cache
uses: actions/cache@v3
id: cache
@ -42,7 +36,7 @@ jobs:
path: |
~/.cargo/registry/cache/
target/
key: ${{ matrix.rust }}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
- name: cargo build
uses: actions-rs/cargo@v1
@ -54,3 +48,9 @@ jobs:
with:
command: clippy
args: --no-deps -- -D warnings
- name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog -D
- name: Release
run: npx semantic-release

27
.releaserc Normal file
View File

@ -0,0 +1,27 @@
{
"branches": [{
"name": "dev",
"prerelease": true
}, "main"],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [{
"type": "build",
"release": "patch"
}]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/git", {
"assets": [
"CHANGELOG.md",
"gradle.properties"
]
}],
["@semantic-release/github", {
"assets": [{
"path": "target/release/revanced-discord-bot"
}]
}]
]
}