-
Notifications
You must be signed in to change notification settings - Fork 7
150 lines (136 loc) · 4.21 KB
/
nightly-build.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
139
140
141
142
143
144
145
146
147
148
149
150
name: MODFLOW 6 nightly build
# Only allow one development build to run at once.
# If a new build is triggered, the previous build
# is cancelled. This allows modflow6 CI to trigger
# the development build when merging into develop,
# guaranteeing that the development distribution
# always consists of the latest state of develop.
concurrency:
group: dev-dist
cancel-in-progress: true
on:
schedule:
- cron: '0 13 * * *' # run at 2 AM UTC
push:
branches:
- master
- develop
- ci-diagnose*
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'
# This lets modflow6 CI workflows trigger this workflow
# when PRs are merged into the modflow6 develop branch.
# This workflow should only be dispatched if the merge-
# triggered CI passes. This _should not_ be dispatched
# if the merge-triggered CI fails or by CI on open PRs.
repository_dispatch:
types: [build]
# workflow_dispatch trigger to start release via GitHub UI or CLI,
# see https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
jobs:
get_version:
name: Get current version
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: MODFLOW-USGS/modflow6-nightly-build
- name: Checkout modflow6
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/modflow6
path: modflow6
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install Python packages
run: pip install -r requirements.txt
- name: Get version
working-directory: modflow6/distribution
id: get_version
run: |
ver=$(python update_version.py -g)
echo "version=${ver}" >> "$GITHUB_OUTPUT"
make_dist:
name: Make development distribution
needs: get_version
uses: MODFLOW-USGS/modflow6/.github/workflows/release.yml@develop
with:
approve: false
branch: develop
developmode: true
full: false
run_tests: false
version: ${{ needs.get_version.outputs.version }}
release:
name: Create release
needs:
- get_version
- make_dist
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
# don't create a release post if triggering event is pull request
if: github.event_name != 'pull_request'
steps:
- name: Delete Older Releases
uses: dev-drprasad/delete-older-releases@v0.3.4
with:
keep_latest: 30
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: nightly
- name: List artifacts
working-directory: nightly
run: |
echo "artifacts include:"
ls -lR .
- name: Prune artifacts
working-directory: nightly
run: |
echo "pruning artifacts"
for f in mf*/mf*; do mv -- "$f" "$(basename $f)"; done
for f in *.zip; do mv -- "$f" "${f##mf*dev*_}"; done
find mf* -type d -delete
rm -rf bin-*
rm -rf release_notes
echo "release assets include:"
ls -lR .
- name: Get date
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYYMMDD
- name: Show time
env:
TIME: "${{ steps.current-time.outputs.time }}"
F_TIME: "${{ steps.current-time.outputs.formattedTime }}"
run: echo $TIME $F_TIME
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.current-time.outputs.formattedTime }}
name: ${{ steps.current-time.outputs.formattedTime }} development build
body: "MODFLOW 6 development build."
draft: false
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "nightly/*.zip,nightly/doc/*.pdf"