-
Notifications
You must be signed in to change notification settings - Fork 24
156 lines (137 loc) · 4.16 KB
/
Copy pathrelease.yml
File metadata and controls
156 lines (137 loc) · 4.16 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Publish release
on:
push:
branches:
- master
# branchname trigger if we had the ability to auto-prep release PRs
# (turned off for doi-usgs org)
#- v[0-9]+.[0-9]+.[0-9]+*
release:
types:
- published
jobs:
release:
name: Create Release
# runs only when changes are merged to master
if: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout master branch
uses: actions/checkout@v7
with:
ref: master
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Modflow-setup ${{ steps.tag_version.outputs.new_tag }}
body: |
Changes in this Release:
${{ steps.tag_version.outputs.changelog }}
draft: true
prerelease: false
docs:
needs: release
name: Publish Docs
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v7
with:
persist-credentials: false
ref: master
fetch-tags: true
- name: Get latest release version number
id: get_version
uses: battila7/get-version-action@v2
- name: Print version
shell: bash
run: |
echo ${{ steps.get_version.outputs.version }}
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v3
with:
environment-file: ci/test_environment.yml
cache-environment: true
cache-downloads: true
- name: Conda info
shell: bash -l {0}
run: micromamba info
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1
- name: Install Modflow-setup and ipykernel
shell: bash -l {0}
run: |
pip install -e .
python -m ipykernel install --user --name mfsetup_ci --display-name "mfsetup_ci"
- name: Conda list
shell: bash -l {0}
run: micromamba list
- name: Run tests
shell: bash -l {0}
run: |
pytest mfsetup/tests/test_notebooks.py
- name: Build docs
shell: bash -l {0}
run: |
set -e
make -C docs html
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build/html
CLEAN: false
TARGET_FOLDER: ${{ steps.get_version.outputs.version }}
publish:
name: Publish package
# runs only after release is published (manually promoted from draft)
# (allows editing of release notes, etc.)
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest #ubuntu-22.04
permissions:
contents: write
pull-requests: write
id-token: write # mandatory for trusted publishing
environment: # requires a 'release' environment in repo settings
name: release
url: https://pypi.org/p/modflow-setup
steps:
- name: Checkout master branch
uses: actions/checkout@v7
with:
ref: master
fetch-tags: true
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*
- name: Upload package
uses: actions/upload-artifact@v7
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1