MODFLOW 6 nightly build #1106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 2 * * *' # 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@v3 | |
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" |