-
Notifications
You must be signed in to change notification settings - Fork 25
138 lines (123 loc) · 4.39 KB
/
releaser.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Release
on:
release:
types: [published]
# Can be called manually
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag'
default: 'latest'
type: string
checkout_ref:
description: 'Ref to checkout for doc index (default to current branch)'
default: ''
type: string
env:
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
jobs:
get_latest_tag:
name: "Get latest release version tag"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.step1.outputs.version }}
steps:
- id: step1
name: "Get version tag"
shell: bash
run: |
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}
version=$(get_latest_release "ansys/pydpf-core")
echo $version
echo "version=$version" >> "$GITHUB_OUTPUT"
Publish_to_PyPI:
name: "Publish Release to PyPI"
runs-on: ubuntu-latest
needs: get_latest_tag
steps:
- name: "Download Release Assets"
uses: robinraju/release-downloader@v1.8
with:
tag: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }}
fileName: "*.whl"
tarBall: false
zipBall: false
out-file-path: "assets"
extract: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Upload to Public PyPI"
run: |
pip install twine
twine upload --skip-existing assets/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
upload_docs_release:
name: "Upload stable documentation"
needs: [Publish_to_PyPI]
runs-on: ubuntu-latest
steps:
- name: "Download Release Asset - HTML"
uses: dsaltares/fetch-gh-release-asset@1.1.0
with:
file: HTML-doc-ansys-dpf-core.zip
token: ${{ secrets.GITHUB_TOKEN }}
version: tags/${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }}
- name: "List downloaded assets"
shell: bash
run: |
ls
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: HTML-doc-ansys-dpf-core.zip
path: HTML-doc-ansys-dpf-core.zip
- name: "Deploy the stable documentation"
uses: ansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
doc-index-stable:
name: "Deploy stable docs index"
runs-on: ubuntu-latest
needs: upload_docs_release
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.checkout_ref || '' }}
- name: "Install the package requirements"
run: |
python3 -m venv .venv
.venv/bin/python -m pip install -e .
- name: "Get the version to PyMeilisearch"
run: |
VERSION=$(.venv/bin/python -c "from ansys.dpf.core import __version__; print('.'.join(__version__.split('.')[:2]))")
VERSION_MEILI=$(.venv/bin/python -c "from ansys.dpf.core import __version__; print('-'.join(__version__.split('.')[:2]))")
echo "Calculated VERSION: $VERSION"
echo "Calculated VERSION_MEILI: $VERSION_MEILI"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV
- name: "Deploy the latest documentation index"
uses: ansys/actions/doc-deploy-index@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}
index-name: pydpf-core-v${{ env.VERSION_MEILI }}
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
decompress-artifact: true
update_ansys_lab_examples:
uses: ./.github/workflows/ansys_lab.yml
needs: get_latest_tag
with:
version: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }}
secrets: inherit