Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
types: [closed]
branches: [master]
workflow_dispatch:

permissions:
contents: read
Expand All @@ -20,8 +21,10 @@ jobs:
runs-on: ubuntu-latest
# Run when PR with 'release' label is merged to master
if: |
github.event.pull_request.merged == true
&& contains(github.event.pull_request.labels.*.name, 'release')
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release'))
outputs:
should-release: ${{ steps.check.outputs.should-release }}
steps:
Expand All @@ -31,21 +34,13 @@ jobs:
ref: master
fetch-depth: 0

- name: Install Rust
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e
with:
toolchain: 1.91.1
components: cargo

- name: Install Sampo CLI
run: cargo install sampo

- name: Check release conditions
id: check
run: |
if sampo release --dry-run; then
changeset_count=$(find .sampo/changesets -name '*.md' 2>/dev/null | wc -l)
if [ "$changeset_count" -gt 0 ]; then
echo "should-release=true" >> "$GITHUB_OUTPUT"
echo "Changesets found, ready to release"
echo "Found $changeset_count changeset(s), ready to release"
else
echo "should-release=false" >> "$GITHUB_OUTPUT"
echo "No changesets to release"
Expand Down Expand Up @@ -109,10 +104,18 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e
with:
toolchain: 1.91.1
components: cargo
toolchain: 1.91.1
components: cargo

- name: Cache Sampo CLI
id: cache-sampo
uses: actions/cache@v3
with:
path: ~/.cargo/bin/sampo
key: sampo-${{ runner.os }}-${{ runner.arch }}

- name: Install Sampo CLI
if: steps.cache-sampo.outputs.cache-hit != 'true'
run: cargo install sampo

- name: Install Hex dependencies
Expand Down Expand Up @@ -161,6 +164,12 @@ jobs:
if: steps.commit-release.outputs.committed == 'true'
run: git push origin --tags

- name: Create GitHub Release
if: steps.commit-release.outputs.committed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "v${{ steps.sampo-release.outputs.new_version }}" --generate-notes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i particularly dont like '--generate-notes' cus its noisy with all merged PRs rather than user facing changes
an idea would be to parse the CHANGELOG.md and add it here so its clearly user facing changes


# Notify in case of a failure
- name: Send failure event to PostHog
if: ${{ failure() }}
Expand Down
1 change: 1 addition & 0 deletions .sampo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version = 1

[git]
default_branch = "master"
short_tags = "posthog" # Tag with v1.2.3 rather than posthog-v1.2.3

[github]
repository = "posthog/posthog-elixir"
Expand Down
Loading