|
1 |
| -name: Bump version and publish |
| 1 | +#name: Bump version and publish |
| 2 | +# |
| 3 | +#on: |
| 4 | +# workflow_run: |
| 5 | +# workflows: [ "CI" ] |
| 6 | +# types: [ completed ] |
| 7 | +# |
| 8 | +#jobs: |
| 9 | +# tag: |
| 10 | +# permissions: |
| 11 | +# contents: write |
| 12 | +# |
| 13 | +# if: > |
| 14 | +# github.event.workflow_run.conclusion == 'success' && |
| 15 | +# github.event.workflow_run.head_branch == 'main' |
| 16 | +# runs-on: ubuntu-latest |
| 17 | +# |
| 18 | +# outputs: |
| 19 | +# tag: ${{ steps.tag_version.outputs.new_tag }} |
| 20 | +# |
| 21 | +# steps: |
| 22 | +# - uses: actions/checkout@v4 |
| 23 | +# |
| 24 | +# - name: Bump version and tag |
| 25 | +# id: tag_version |
| 26 | +# uses: mathieudutour/github-tag-action@v6.2 |
| 27 | +# with: |
| 28 | +# github_token: ${{ secrets.GITHUB_TOKEN }} |
| 29 | +# |
| 30 | +# - name: Create GitHub release |
| 31 | +# uses: softprops/action-gh-release@v2 |
| 32 | +# with: |
| 33 | +# tag_name: ${{ steps.tag_version.outputs.new_tag }} |
| 34 | +# generate_release_notes: true |
| 35 | +# |
| 36 | +# build: |
| 37 | +# needs: tag |
| 38 | +# runs-on: ubuntu-latest |
| 39 | +# steps: |
| 40 | +# - uses: actions/checkout@v4 |
| 41 | +# |
| 42 | +# - name: Setup Python |
| 43 | +# uses: actions/setup-python@v5 |
| 44 | +# with: |
| 45 | +# python-version: '3.12' |
| 46 | +# |
| 47 | +# - name: Install hatch |
| 48 | +# run: | |
| 49 | +# pip install hatch |
| 50 | +# |
| 51 | +# - name: Build package |
| 52 | +# run: | |
| 53 | +# sed -i "s/0.0.0/${{ needs.tag.outputs.tag }}/" pyproject.toml |
| 54 | +# # Constructs the dist folder |
| 55 | +# hatch build |
| 56 | +# |
| 57 | +# - uses: actions/upload-artifact@v4 |
| 58 | +# with: |
| 59 | +# name: dist |
| 60 | +# path: dist |
| 61 | +# |
| 62 | +# |
| 63 | +# publish: |
| 64 | +# needs: build |
| 65 | +# runs-on: ubuntu-latest |
| 66 | +# environment: release |
| 67 | +# |
| 68 | +# permissions: |
| 69 | +# # This permission is required for trusted publishing. |
| 70 | +# id-token: write |
| 71 | +# |
| 72 | +# steps: |
| 73 | +# - uses: actions/download-artifact@v4 |
| 74 | +# with: |
| 75 | +# name: dist |
| 76 | +# path: dist |
| 77 | +# |
| 78 | +# - name: Publish to PyPI |
| 79 | +# uses: pypa/gh-action-pypi-publish@release/v1 |
| 80 | + |
| 81 | + |
| 82 | +# .github/workflows/release.yml |
| 83 | +name: Release |
2 | 84 |
|
3 | 85 | on:
|
4 | 86 | workflow_run:
|
5 | 87 | workflows: [ "CI" ]
|
6 | 88 | types: [ completed ]
|
7 | 89 |
|
8 | 90 | jobs:
|
9 |
| - tag: |
10 |
| - permissions: |
11 |
| - contents: write |
12 |
| - |
| 91 | + release: |
13 | 92 | if: >
|
14 | 93 | github.event.workflow_run.conclusion == 'success' &&
|
15 | 94 | github.event.workflow_run.head_branch == 'main'
|
16 |
| - runs-on: ubuntu-latest |
17 |
| - |
18 |
| - outputs: |
19 |
| - tag: ${{ steps.tag_version.outputs.new_tag }} |
20 |
| - |
21 |
| - steps: |
22 |
| - - uses: actions/checkout@v4 |
23 |
| - |
24 |
| - - name: Bump version and tag |
25 |
| - id: tag_version |
26 |
| - uses: mathieudutour/github-tag-action@v6.2 |
27 |
| - with: |
28 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
29 | 95 |
|
30 |
| - - name: Create GitHub release |
31 |
| - uses: softprops/action-gh-release@v2 |
32 |
| - with: |
33 |
| - tag_name: ${{ steps.tag_version.outputs.new_tag }} |
34 |
| - generate_release_notes: true |
35 |
| - |
36 |
| - build: |
37 |
| - needs: tag |
38 | 96 | runs-on: ubuntu-latest
|
39 |
| - steps: |
40 |
| - - uses: actions/checkout@v4 |
41 |
| - |
42 |
| - - name: Setup Python |
43 |
| - uses: actions/setup-python@v5 |
44 |
| - with: |
45 |
| - python-version: '3.12' |
46 |
| - |
47 |
| - - name: Install hatch |
48 |
| - run: | |
49 |
| - pip install hatch |
50 |
| -
|
51 |
| - - name: Build package |
52 |
| - run: | |
53 |
| - sed -i "s/0.0.0/${{ needs.tag.outputs.tag }}/" pyproject.toml |
54 |
| - # Constructs the dist folder |
55 |
| - hatch build |
56 |
| -
|
57 |
| - - uses: actions/upload-artifact@v4 |
58 |
| - with: |
59 |
| - name: dist |
60 |
| - path: dist |
61 |
| - |
62 |
| - |
63 |
| - publish: |
64 |
| - needs: build |
65 |
| - runs-on: ubuntu-latest |
66 |
| - environment: release |
67 | 97 |
|
68 | 98 | permissions:
|
69 |
| - # This permission is required for trusted publishing. |
70 |
| - id-token: write |
| 99 | + contents: write |
| 100 | + id-token: write # For trusted publishing |
71 | 101 |
|
72 | 102 | steps:
|
73 |
| - - uses: actions/download-artifact@v4 |
| 103 | + - uses: cvxgrp/.github/actions/release@main |
74 | 104 | with:
|
75 |
| - name: dist |
76 |
| - path: dist |
77 |
| - |
78 |
| - - name: Publish to PyPI |
79 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
| 105 | + python-version: '3.12' # Optional, defaults to 3.12 |
| 106 | + build-tool: 'hatch' # Optional, defaults to hatch |
0 commit comments