Skip to content

Commit

Permalink
Automatically post GitHub release on tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Oct 28, 2024
1 parent c221665 commit 0f0fcac
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Build wheels
name: release

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -17,6 +20,10 @@ on:

workflow_dispatch:

defaults:
run:
shell: bash

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Expand Down Expand Up @@ -187,3 +194,88 @@ jobs:
with:
status: ${{ job.status }}
channel: '#dev-freud'

source:
name: Build source tarball
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
path: code
submodules: true

- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"

- name: Copy source
run: cp -R code "${name}-${ref}"

- name: Remove .git
run: rm -rf "${name}-${ref}/.git" && ls -laR "${name}-${ref}"

- name: Tar/zstd source
run: tar --zstd -cvf "${name}-${ref}.tar.zst" "${name}-${ref}"

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: source
path: |
*.tar.*
release-notes:
name: Extract release notes
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
path: code

- name: Write release-notes.md
# 1. Search for the content from the start of the file to the 2nd version heading.
# 2. Remove the 2nd version heading.
# 3. Search for the content after the first version heading (removes any description at the
# start of the file.
# 4. Remove the 1st version heading.
# This leaves the content of the release notes for the current release.
run: >
grep -P -m 2 -B 10000 "^## v*\d*\.\d*\.\d*" ChangeLog.md |
sed '$d' |
grep -P -A 10000 "^## v*\d*\.\d*\.\d*" |
sed '1d' |
tee "${GITHUB_WORKSPACE}/release-notes.md"
working-directory: code

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: release-notes
path: |
release-notes.md
publish_github:
name: Publish [GitHub]
needs: [release-notes, source]
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
merge-multiple: true

- name: List files
run: ls -lR

- name: Create release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*.zst
body_path: release-notes.md
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ Alain Kadar <[email protected]> AlainKadar <[email protected]>
Melody Zhang <[email protected]> Melody Zhang <[email protected]>
Melody Zhang <[email protected]> yiyuanmz <[email protected]>
Jen Bradley <[email protected]> janbridley <[email protected]>
Andrew Kerr <[email protected]> Andrew Kerr <[email protected]>
Andrew Kerr <[email protected]> Andrew Kerr <[email protected]>
Suraj Kannur <[email protected]> surajkannur <[email protected]>
Suraj Kannur <[email protected]> surajkannur <[email protected]>


60 changes: 0 additions & 60 deletions contributors.txt

This file was deleted.

0 comments on commit 0f0fcac

Please sign in to comment.