diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f74736b32..70266d628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: publish-docker: runs-on: ubuntu-latest - needs: build-docker + needs: test steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3.0.1 @@ -107,10 +107,11 @@ jobs: # TODO: --all-tags does not seem to work with the version on github-actions # docker push --all-tags eoxa/eoxserver for tag in $(docker image ls --format "{{.Tag}}" eoxa/eoxserver) ; do docker push "eoxa/eoxserver:$tag" ; done - if: success() + if: success() && (steps.branch_name.outputs.SOURCE_TAG || github.ref == 'refs/heads/master') publish-pypi: runs-on: ubuntu-latest + needs: test if: contains(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 @@ -124,8 +125,11 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel python setup.py sdist bdist_wheel - echo ::set-output name=WHEEL_FILE::$(ls dist/*.whl) - echo ::set-output name=SRC_DIST_FILE::$(ls dist/*.tar.gz) + - uses: actions/upload-artifact@v3 + with: + name: eoxserver-dist + path: ./dist/ + retention-days: 2 - name: Push package to pypi uses: pypa/gh-action-pypi-publish@master with: @@ -133,15 +137,21 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} if: success() - release: + publish-github: runs-on: ubuntu-latest + needs: publish-pypi if: contains(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3.0.1 + with: + name: eoxserver-dist - name: Branch name id: branch_name run: | echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") + echo ::set-output name=WHEEL_FILE::$(ls dist/*.whl) + echo ::set-output name=SRC_DIST_FILE::$(ls dist/*.tar.gz) - name: Draft Release id: create_release uses: actions/create-release@v1 @@ -157,8 +167,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ steps.build_python_release.outputs.WHEEL_FILE }} - asset_name: ${{ steps.build_python_release.outputs.WHEEL_FILE }} + asset_path: ${{ steps.branch_name.outputs.WHEEL_FILE }} + asset_name: ${{ steps.branch_name.outputs.WHEEL_FILE }} asset_content_type: application/x-wheel+zip if: success() - name: Upload Release Asset Source Dist @@ -167,14 +177,14 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{ steps.build_python_release.outputs.SRC_DIST_FILE }} - asset_name: ${{ steps.build_python_release.outputs.SRC_DIST_FILE }} + asset_path: ${{ steps.branch_name.outputs.SRC_DIST_FILE }} + asset_name: ${{ steps.branch_name.outputs.SRC_DIST_FILE }} asset_content_type: application/tar+gzip if: success() notify: runs-on: ubuntu-20.04 - needs: release + needs: publish-github steps: - name: action-slack uses: 8398a7/action-slack@v3.8.0 diff --git a/README.md b/README.md index 7d9c8eb11..fcc9204cb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ EOxServer is a Python application and library for presenting Earth Observation (EO) data and metadata. -![build](https://github.com/EOxServer/eoxserver/actions/workflows/build.yml/badge.svg) +![build](https://github.com/EOxServer/eoxserver/actions/workflows/ci.yml/badge.svg) [![PyPi](https://badge.fury.io/py/EOxServer.svg)](https://pypi.org/project/EOxServer/) [![ReadTheDocs](https://readthedocs.org/projects/eoxserver/badge/?version=master)](http://docs.eoxserver.org/en/master)