-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (79 loc) · 2.64 KB
/
release.yml
File metadata and controls
94 lines (79 loc) · 2.64 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: "Release"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
on:
push:
branches:
- main
- master
jobs:
trigger-release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
target-branch: ${{ github.ref_name }}
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json
publish-release:
name: "Publish package to GitHub and PyPi release"
needs: trigger-release
if: needs.trigger-release.outputs.release_created
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version-file: 'pyproject.toml'
- name: Print python version
run: python --version
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-0
- name: Setup Poetry
uses: snok/install-poetry@v1
if: steps.cached-poetry.outputs.cache-hit != 'true'
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Build Package
run: |
poetry build --no-interaction --format=wheel
- name: Add artifacts to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Uploading artifacts to release ${{ needs.trigger-release.outputs.tag_name }}"
gh release upload ${{ needs.trigger-release.outputs.tag_name }} ./dist/*.whl
- name: Publish package to PyPi
run: |
poetry config repositories.nuvla-api https://pypi.org/project/nuvla-api/
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
job-notify:
if: needs.trigger-release.outputs.release_created
name: Post Workflow Status To Slack
needs: publish-release
runs-on: ubuntu-latest
steps:
- uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}