ruff-pre-commit/.github/workflows/release.yml
CoderJoshDK 53e3b33bd4
feat(workflow): auto release on tag creation (#81)
## Summary

Add a GitHub workflow for creating a new release, automatically, when a
new tag is created.

This solves #78. The code is very similar to the changes added in
https://github.com/astral-sh/uv-pre-commit/pull/6

The primary difference, is that the URL points to ruff and this one
checks for if the tag starts with a `v`, but it is optional. This lets
you change ruff versions to not have a `v` in the future. Although the
`mirror.py` will need to be updated.
Speaking of updates to `mirror.py`, I ran `ruff` on it and updated the
`subprocess` to raise an error on failure.

## Test Plan

Locally tested.
2024-03-30 19:17:08 -04:00

21 lines
442 B
YAML

name: Releases
on:
push:
tags:
- 'v?[0-9]+.[0-9]+.[0-9]*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "See: https://github.com/astral-sh/ruff/releases/tag/$TAG_NAME"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}