Skip to content

Commit

Permalink
ci: use cocogitto for release
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Nov 29, 2023
1 parent 70de57e commit e155a24
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

jobs:
lints:
name: Format & Lint
Expand Down Expand Up @@ -107,7 +110,15 @@ jobs:
chmod +x -R target/x86_64-unknown-linux-musl/release
working-directory: ./

- name: Update multi-arch container latest
- if: ${{ github.ref_type }} == 'tag'
name: Update multi-arch container latest
run: |
docker buildx build \
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
. -t oknozor/cocogitto_github_app:${{ github.ref_name }}
- if: ${{ github.ref_type }} == 'branch'
name: Update multi-arch container latest
run: |
docker buildx build \
--push --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
name: SemVer release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config --global user.email github-actions@github.com
git config --global user.name github-actions
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- run:
cargo install cargo-edit

- name: SemVer release
id: release
uses: cocogitto/cocogitto-action@v3.5
with:
check-latest-tag-only: true
release: true
git-user: 'github-actions'
git-user-email: 'github-actions@github.com'

- name: Generate Changelog
run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md

- name: Upload github release
uses: softprops/action-gh-release@v1
with:
body_path: GITHUB_CHANGELOG.md
tag_name: ${{ steps.release.outputs.version }}
25 changes: 23 additions & 2 deletions cog.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
branch_whitelist = ["main"]
ignore_merge_commits = true

pre_bump_hooks = [
"cargo build --release",
"cargo clippy",
"cargo fmt --all",
"cargo bump {{version}}",
"cargo set-version {{version}}",
]

post_bump_hooks = [
Expand All @@ -15,6 +18,24 @@ template = "remote"
remote = "github.com"
owner = "cocogitto"
repository = "cocogitto-bot"

authors = [
{ signature = "Paul Delafosse", username = "oknozor" },
]
]

[git_hooks.commit-msg]
script = """#!/bin/sh
set -e
echo "[Check current commit message]"
cog verify --file $1
echo "[Conventional commit check]"
cog check
echo "[Format code]"
cargo fmt -v --all --check
echo "[Lints]"
cargo clippy
"""

0 comments on commit e155a24

Please sign in to comment.