Skip to content

Commit

Permalink
build: add an automatic release job
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmarc committed Apr 25, 2024
1 parent fb31b19 commit d74bcdd
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[changelog]
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} \
({{ commit.id }})\
{% endfor %}
{% endfor %}\n
"""

[git]
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->New Features" },
{ message = "^fix", group = "<!-- 1 -->Bugfixes" },
{ message = "^doc", skip = true },
{ message = "^perf", skip = true },
{ message = "^refactor", skip = true },
{ message = "^style", skip = true },
{ message = "^test", skip = true },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", skip = true },
{ body = ".*security", skip = true },
{ message = "^revert", skip = true },
]
52 changes: 52 additions & 0 deletions .github/workflows/release-mmserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
push:
tags:
- 'mmserver-v*.*.*'

name: Release mmserver
jobs:
create_release:
name: Create mmserver release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu

- uses: actions/checkout@v4
- uses: swatinem/rust-cache@v2
with:
workspaces: |
mm-server
mm-client
mm-protocol
- name: install deps
run: sudo apt install nasm cmake protobuf-compiler libxkbcommon-dev

- name: cargo build
run: (cd mm-server && cargo build --bin mmserver --release --target x86_64-unknown-linux-gnu)
- name: create release tarball
run: |-
mkdir "${RUNNER_TEMP}/${GITHUB_REF_NAME}"
cp -r mm-server/target/x86_64-unknown-linux-gnu/release/mmserver README.md "${RUNNER_TEMP}/${GITHUB_REF_NAME}"
cp LICENSES/BUSL-1.1.txt "${RUNNER_TEMP}/${GITHUB_REF_NAME}/LICENSE.txt"
tar -C "${RUNNER_TEMP}" --numeric-owner -cvzf "${GITHUB_REF_NAME}-linux-amd64.tar.gz" "$GITHUB_REF_NAME"
- name: install git-cliff
run: cargo install git-cliff
- name: generate release notes
run: |-
echo "Server version ${GITHUB_REF_NAME/mmserver-v//}" >> release-notes.txt
git cliff -c .github/workflows/cliff.toml --include-path "mm-server/**/*" | tail -n +2 >> release-notes.txt
- name: create release
uses: softprops/action-gh-release@v2
with:
body_path: release-notes.txt
files: "mmserver-*.tar.gz"



0 comments on commit d74bcdd

Please sign in to comment.