Skip to content

Commit

Permalink
Tag and release in one go
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Dec 19, 2024
1 parent 49a78b7 commit 6b6ca12
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Package and release
name: Tag and release
on:
push:
tags:
- '**'
branches:
- main
paths:
- CHANGELOG.md

permissions:
contents: write # required to tag through API

jobs:
release:
Expand All @@ -11,6 +16,19 @@ jobs:
- name: Clone project
uses: actions/checkout@v4

- name: Get latest version from changelog header
run: echo "tag=$(grep -m 1 -oP '(?<=### Changes in )(\d{5,}.\d{1,}-\w+)(?=:)' CHANGELOG.md)" >> "$GITHUB_OUTPUT"
id: changelog

- name: Tag
# honestly a crap action, find a better one
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # why tho, just read the env..
create_annotated_tag: true # lightweight by default
custom_tag: ${{ steps.changelog.outputs.tag }}
tag_prefix: '' # otherwise it'll prepend "v"

- name: Trim changelog
run: sed -ni '1p;2,/^###/{/^###/q;p;}' CHANGELOG.md

Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/tag.yml

This file was deleted.

0 comments on commit 6b6ca12

Please sign in to comment.