diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..3dd6671 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,12 @@ +[bumpversion] +current_version = v1.0.0 +commit = True +tag = True +parse = (v(?P\d+))(.(?P\d+))(.(?P\d+)) +serialize = v{major}.{minor}.{patch} + +[bumpversion:file:CITATION.cff] + +[bumpversion:file:notebook.ipynb] +search = "print('Notebook repository version: {current_version}')\n" +replace = "print('Notebook repository version: {new_version}')\n" diff --git a/.github/workflows/binder.yaml b/.github/workflows/binder.yaml index 0de1a9c..d5571b3 100644 --- a/.github/workflows/binder.yaml +++ b/.github/workflows/binder.yaml @@ -1,5 +1,5 @@ # Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html -name: test this PR on Binder Badge +name: Test this PR on Binder Badge on: pull_request_target: types: [opened] diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d6b8b57..8b49ac5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,9 +1,10 @@ -name: build and push container image +name: Build and push container image on: push: branches: - main + - postprint jobs: build-and-push: diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml new file mode 100644 index 0000000..5654d1a --- /dev/null +++ b/.github/workflows/preview.yaml @@ -0,0 +1,74 @@ +name: Preview + +on: + workflow_run: + workflows: ["Build and push container image"] + branches: [postprint] + types: [completed] + +# This job installs dependencies, build the jupyter notebook, and pushes it to `preview`, a new `branch` +jobs: + on-success: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'success' }} + defaults: + run: + shell: bash -l {0} + steps: + - name: Check conditions meet + run: echo 'The triggering workflow passed' + - uses: actions/checkout@v2 + with: + ref: postprint + # Set notebook name + - name: Get properties from the config file + id: config_file + uses: notiz-dev/github-action-json-property@release + with: + path: '.github/config.json' + prop_path: 'notebook_name' + # Set quay image + - name: Get properties from the config file + id: config_quay + uses: notiz-dev/github-action-json-property@release + with: + path: '.github/config.json' + prop_path: 'quay_image' + # Set kernel name + - name: Get properties from the config file + id: config_kernel + uses: notiz-dev/github-action-json-property@release + with: + path: '.github/config.json' + prop_path: 'kernel' + # Render the notebook + - name: Run the build process with Docker + uses: addnab/docker-run-action@v3 + with: + image: quay.io/${{steps.config_quay.outputs.prop}}:latest + options: --user root -v ${{ github.workspace }}:/tmp + shell: bash + run: | + v=$(jupyter kernelspec list | awk '{print $1}' | egrep ${{steps.config_kernel.outputs.prop}}) + jupyter-nbconvert --to notebook --ExecutePreprocessor.kernel_name="$v" --inplace --execute ${{steps.config_file.outputs.prop}} + cp ${{steps.config_file.outputs.prop}} /tmp + - name: Commit + run: | + ls + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git rm \* ':!${{steps.config_file.outputs.prop}}' + git add ${{steps.config_file.outputs.prop}} + git commit -m 'update' + - name: Push + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: preview + force: true + on-failure: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'failure' }} + steps: + - name: Check conditions meet + run: echo 'The triggering workflow failed' \ No newline at end of file diff --git a/.github/workflows/render.yaml b/.github/workflows/render.yaml index 6b32279..81e0dfd 100644 --- a/.github/workflows/render.yaml +++ b/.github/workflows/render.yaml @@ -3,6 +3,7 @@ name: render on: workflow_run: workflows: ["Build and push container image"] + branches: main types: - completed diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c1e29dd..69140db 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: test container image build +name: Test container image build on: pull_request: diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..15738da --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,22 @@ +cff-version: 1.2.0 +title: "Tree crown detection using DeepForest" +message: "If you use this software, please cite it using the metadata from this file." +type: software +authors: + - family-names: Coca-Castro + given-names: Alejandro + website: https://github.com/acocac + affiliation: The Alan Turing Institute + - name: "This EDS book notebook contributors" + website: "https://github.com/eds-book-gallery/15d986da-2d7c-44fb-af71-700494485def/graphs/contributors" +version: v1.0.0 # This is automatically set using the bumpversion tool. +identifiers: + - type: doi + value: TBA + description: The concept DOI for the collection containing all versions of the notebook. +abstract: "Notebook developed to demonstrate how to detect tree crown using a state-of-art Deep Learning model for object detection." +keywords: + - Environmental Data Science + - Forest + - Modelling + - Deep learning \ No newline at end of file diff --git a/README.md b/README.md index 9de6d4a..7723d79 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,6 @@ license - - binder - render @@ -26,13 +23,20 @@

+

+ + binder + + + binder + +
+

+

RoHub - - doi -

diff --git a/notebook.ipynb b/notebook.ipynb index fbd9ca8..8744e41 100644 --- a/notebook.ipynb +++ b/notebook.ipynb @@ -16,9 +16,6 @@ " \n", " \"license\"\n", " \n", - " \n", - " \"binder\"\n", - " \n", " \n", " \"render\"\n", " \n", @@ -29,12 +26,19 @@ "

\n", "\n", "

\n", + " \n", + " \"binder\"\n", + " \n", + " \n", + " \"binder\"\n", + " \n", + "
\n", + "

\n", + "\n", + "

\n", " \n", " \"RoHub\"\n", " \n", - " \n", - " \"doi\"\n", - " \n", "

\n" ] }, @@ -598,7 +602,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Alejandro Coca-Castro, and Matt Allen. \"Tree crown detection using DeepForest (Jupyter Notebook) published in the Environmental Data Science book.\" ROHub. Feb 20 ,2022. https://doi.org/10.24424/td9g-0533." + "Please see [CITATION.cff](https://github.com/eds-book-gallery/15d986da-2d7c-44fb-af71-700494485def/blob/main/CITATION.cff) for the full citation information. The citation file can be exported to APA or BibTex formats (learn more [here](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files))." ] }, { @@ -618,6 +622,8 @@ "outputs": [], "source": [ "from datetime import date\n", + "\n", + "print('Notebook repository version: v1.0.0')\n", "print(f'Last tested: {date.today()}')" ] },