Skip to content

Commit

Permalink
chore: Update CI release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Jul 11, 2024
1 parent f91e219 commit 76f8206
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 26 deletions.
47 changes: 21 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
- "v*.*.*"

jobs:
create-release:
changelog:
name: create-release
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
eksup_version: ${{ env.EKSUP_VERSION }}
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -28,23 +28,18 @@ jobs:
echo "version is: ${{ env.EKSUP_VERSION }}"
- name: Generate a changelog
id: changelog
uses: orhun/git-cliff-action@v2
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
args: --latest --strip header -o CHANGELOG.md

- name: Check release
run: cat CHANGELOG.md

- name: Release
id: release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}

build-release:
name: build-release
needs: ['create-release']
needs: ['changelog']
permissions:
contents: write
runs-on: ${{ matrix.os }}
Expand All @@ -70,11 +65,11 @@ jobs:
rust: nightly
target: arm-unknown-linux-gnueabihf
- build: macos
os: macos-12
os: macos-14
rust: nightly
target: x86_64-apple-darwin
- build: macos-arm
os: macos-12
os: macos-14
rust: nightly
target: aarch64-apple-darwin
- build: win-msvc
Expand Down Expand Up @@ -116,12 +111,12 @@ jobs:
echo "target dir is: ${{ env.TARGET_DIR }}"
- name: Build release binary
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }}
run: ${{ env.CARGO }} build --package eksup --verbose --release ${{ env.TARGET_FLAGS }}

- name: Build archive
shell: bash
run: |
STAGING="eksup-${{ needs.create-release.outputs.eksup_version }}-${{ matrix.target }}"
STAGING="eksup-${{ needs.changelog.outputs.eksup_version }}-${{ matrix.target }}"
mkdir -p "${STAGING}"
cp {README.md,LICENSE} "${STAGING}/"
Expand All @@ -136,12 +131,12 @@ jobs:
echo "ASSET=${STAGING}.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
tag: ${{ github.ref }}
overwrite: true
body: ${{ needs.changelog.outputs.release_body }}
55 changes: 55 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Configuration file for [`git-cliff`](https://github.com/orhun/git-cliff)
# See https://git-cliff.org/docs/configuration

[remote.github]
owner = "clowdhaus"
repo = "eksup"

[changelog]
header = """
# Changelog
All notable changes to this project will be documented in this file.
"""
# https://keats.github.io/tera/docs/#introduction
body = """\
{% set gh_link = "https://github.com/" ~ remote.github.owner ~ "/" ~ remote.github.repo %}\
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}]({{ gh_link }}/releases/tag/v{{ version | trim_start_matches(pat="v") }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [Unreleased]({{ gh_link }}/compare/{{ previous.version }}...HEAD)
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | title }}
{% for commit in commits %}
- {% if commit.scope %}[{{ commit.scope }}] {% endif %}{{ commit.message | upper_first | split(pat="\\n") | first }}\
{% endfor %}
{% endfor %}\n
"""
trim = true
footer = """
"""

[git]
conventional_commits = true
filter_unconventional = false
commit_preprocessors = []
commit_parsers = [
{ message = "^[Ff]eat", group = "Features" },
{ message = "^[Ff]ix", group = "Bug Fixes" },
{ message = "^[Dd]oc", group = "Documentation" },
{ message = ".*\\b([Dd]eps|[Dd]ependencies|[Bb]ump)\\b", group = "Dependencies" },
{ message = "^[Pp]erf", group = "Performance" },
{ message = "^[Rr]efactor", group = "Refactor" },
{ message = ".*\\b([Ss]tyle|[Ff]mt|[Ff]ormat)\\b", group = "Styling" },
{ message = "^[Tt]est", group = "Testing" },
{ message = "^[Cc]hore", group = "Miscellaneous Tasks" },

{ message = ".*", group = "Other" },
]
protect_breaking_commits = false
filter_commits = false
tag_pattern = "v[0-9]*"
skip_tags = "beta|alpha"
ignore_tags = "rc"
sort_commits = "newest"

0 comments on commit 76f8206

Please sign in to comment.