Fix a bug with the HAMLET-data folder #26
Workflow file for this run
This file contains hidden or 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: Publish release on tag creation | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| defaults: | |
| run: | |
| # This is needed for miniconda, see: | |
| # https://github.com/marketplace/actions/setup-miniconda#important. | |
| shell: bash -l {0} | |
| jobs: | |
| release_checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| - name: Setup Miniforge | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: HAMLET | |
| use-mamba: true | |
| # This is used to invalidate the conda environment every week | |
| - name: Get year and week (for conda cache) | |
| id: get-date | |
| run: echo "week=$(/bin/date -u '+%Y-w%V')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Cache conda environment | |
| id: conda-cache | |
| uses: actions/cache@v4 | |
| env: | |
| # Increase this value to manually invalidate the cache | |
| CACHE_NUMBER: 0 | |
| with: | |
| path: ${{ env.CONDA }}/envs | |
| key: conda-${{ hashFiles('environment.yml') }}-${{ steps.get-date.outputs.week }}-${{ env.CACHE_NUMBER }} | |
| - name: Update HAMLET environment | |
| run: mamba env update -n HAMLET -f environment.yml | |
| if: steps.conda-cache.outputs.cache-hit != 'true' | |
| - name: Get shortened version of release tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Check release version is set correctly in every file | |
| run: python3 utilities/check-version.py ${{ env.RELEASE_VERSION }} | |
| - name: Run release tests in conda environment | |
| run: >- | |
| pytest --keep-workflow-wd-on-fail | |
| --tag release | |
| documentation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Miniforge | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: HAMLET | |
| use-mamba: true | |
| # This is used to invalidate the conda environment every week | |
| - name: Get year and week (for conda cache) | |
| id: get-date | |
| run: echo "week=$(/bin/date -u '+%Y-w%V')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Cache conda environment | |
| id: conda-cache | |
| uses: actions/cache@v4 | |
| env: | |
| # Increase this value to manually invalidate the cache | |
| CACHE_NUMBER: 0 | |
| with: | |
| path: ${{ env.CONDA }}/envs | |
| key: conda-${{ hashFiles('environment.yml') }}-${{ steps.get-date.outputs.week }}-${{ env.CACHE_NUMBER }} | |
| - name: Update HAMLET environment | |
| run: mamba env update -n HAMLET -f environment.yml | |
| if: steps.conda-cache.outputs.cache-hit != 'true' | |
| - name: Install LaTeX | |
| run: sudo apt install --no-install-recommends -y latexmk texlive-latex-base texlive-latex-recommended tex-gyre texlive-latex-extra | |
| - name: Get shortened version of release tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Build the documentation | |
| run: make --directory docs latexpdf | |
| - name: Rename documentation | |
| run: mv docs/build/latex/hamlet.pdf HAMLET-manual-${{ env.RELEASE_VERSION }}.pdf | |
| - name: Upload documentation as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation | |
| path: HAMLET-manual-${{ env.RELEASE_VERSION }}.pdf | |
| retention-days: 1 | |
| run_tests: | |
| uses: ./.github/workflows/ci.yml | |
| needs: | |
| - release_checks | |
| package: | |
| name: Package source files | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release_checks | |
| - run_tests | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| - name: Get shortened version of release tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Package source code | |
| shell: bash | |
| run: | | |
| find * | grep -v "\.git\|pytest.ini" | tar -czvf HAMLET-${{ env.RELEASE_VERSION }}.tar.gz --files-from - | |
| - name: Print event context | |
| env: | |
| EVENT_CONTEXT: ${{ toJSON(github.event) }} | |
| run: | | |
| echo $EVENT_CONTEXT | |
| - name: Upload archive as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-tar | |
| path: HAMLET-${{ env.RELEASE_VERSION }}.tar.gz | |
| retention-days: 1 | |
| release: | |
| name: Create release | |
| needs: | |
| - release_checks | |
| - run_tests | |
| - package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| - name: Get shortened version of release tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Download release tarball | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-tar | |
| - name: Download documentation | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: documentation | |
| - name: Download example HAMLET report | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: HAMLET-example | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python3 utilities/release_notes.py CHANGELOG.rst ${{ env.RELEASE_VERSION }} > release-notes.rst | |
| gh release create \ | |
| ${{ env.RELEASE_VERSION}} \ | |
| --notes-file release-notes.rst \ | |
| HAMLET-${{ env.RELEASE_VERSION}}.tar.gz \ | |
| HAMLET-manual-${{ env.RELEASE_VERSION }}.pdf \ | |
| HAMLET-example* |