-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (80 loc) · 2.39 KB
/
build_wheels.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
name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: build_wheels_on_${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: awvwgk/setup-fortran@main
id: setup-fortran
with:
compiler: gcc
version: 11
- name: Build wheels (Not Windows)
if: runner.os != 'Windows'
uses: pypa/[email protected]
- name: Build wheels (Windows)
if: runner.os == 'Windows'
uses: pypa/[email protected]
env:
CMAKE_GENERATOR: MinGW Makefiles
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
make_sdist:
name: make_sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
tag_and_release:
name: tag_version
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
permissions: write-all
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install_hatch
run: pipx install hatch
- name: get_version
run: |
echo "VERSION=$(hatch version)" >> $GITHUB_ENV
- name: check_if_tag_exists_for_version
run: |
if git show-ref --tags --verify --quiet "refs/tags/${VERSION}"; then
echo "Tag ${VERSION} exists."
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "Tag ${VERSION} does not exist."
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: create_release_tag
uses: actions/github-script@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.TAG_EXISTS == 'false' }}
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${process.env.VERSION}`,
sha: context.sha,
})
- name: create_release_from_tag
uses: softprops/action-gh-release@v2
if: ${{ env.TAG_EXISTS == 'false' }}
with:
tag_name: ${{ env.VERSION }}