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: on:
push: push:
branches: branches: [main, dev]
- main
pull_request:
workflow_dispatch:
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
build: build:
strategy:
fail-fast: false
matrix:
rust: [stable, nightly]
name: ${{ matrix.rust }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -31,10 +20,15 @@ jobs:
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: ${{ matrix.rust }} toolchain: stable
override: true override: true
components: clippy components: clippy
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Cache - name: Cache
uses: actions/cache@v3 uses: actions/cache@v3
id: cache id: cache
@ -42,7 +36,7 @@ jobs:
path: | path: |
~/.cargo/registry/cache/ ~/.cargo/registry/cache/
target/ 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 - name: cargo build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -54,3 +48,9 @@ jobs:
with: with:
command: clippy command: clippy
args: --no-deps -- -D warnings 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"
}]
}]
]
}