-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55c053c
commit 6e464f6
Showing
4 changed files
with
141 additions
and
125 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,18 @@ | ||
name: build | ||
on: | ||
push: | ||
tags: | ||
- "release-[0-9]+.[0-9]+.[0-9]+" | ||
branches: [master] | ||
paths: | ||
- '.github/workflows/tests.yaml' | ||
- 'setup.py' | ||
- 'setup.cfg' | ||
- 'MANIFEST.in' | ||
- 'pyproject.toml' | ||
- 'eoxserver/**' | ||
jobs: | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
- name: Build the eoxserver docker image | ||
run: | | ||
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "") | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
if: success() | ||
- name: Tag docker latest image | ||
run: | | ||
docker tag eoxserver eoxa/eoxserver:latest | ||
if: success() && steps.branch_name.outputs.SOURCE_BRANCH == 'master' | ||
- name: Tag docker release image | ||
run: | | ||
docker tag eoxserver eoxa/eoxserver:${{ steps.branch_name.outputs.SOURCE_TAG }} | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
- name: Push docker images | ||
run: | | ||
# 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() | ||
build-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "") | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Build Python package | ||
id: build_python_release | ||
run: | | ||
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) | ||
if: startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-') | ||
- name: Push package to pypi | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-') | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "") | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ steps.branch_name.outputs.SOURCE_TAG }} | ||
draft: true | ||
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-') | ||
- name: Upload Release Asset Wheel | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
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_content_type: application/x-wheel+zip | ||
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-') | ||
- name: Upload Release Asset Source Dist | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
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_content_type: application/tar+gzip | ||
if: success() && matrix.latest && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-') | ||
notify: | ||
runs-on: ubuntu-20.04 | ||
needs: release | ||
steps: | ||
- name: action-slack | ||
uses: 8398a7/[email protected] | ||
with: | ||
status: ${{ needs.run.result }} | ||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() | ||
docker build -t eoxserver . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: publish | ||
on: | ||
workflow_run: | ||
workflows: | ||
- test | ||
tags: | ||
- "release-[0-9]+.[0-9]+.[0-9]+" | ||
branches: | ||
- master | ||
types: | ||
- completed | ||
jobs: | ||
build-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Build Python package | ||
id: build_python_release | ||
run: | | ||
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) | ||
if: steps.branch_name.outputs.SOURCE_TAG | ||
publish-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
if: success() | ||
- name: Tag docker latest image | ||
run: | | ||
docker tag eoxserver eoxa/eoxserver:latest | ||
if: github.ref == 'refs/heads/master' | ||
- name: Tag docker release image | ||
run: | | ||
docker tag eoxserver eoxa/eoxserver:${{ steps.branch_name.outputs.SOURCE_TAG }} | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
- name: Push docker images | ||
run: | | ||
# 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() | ||
publish-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Push package to pypi | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "") | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ steps.branch_name.outputs.SOURCE_TAG }} | ||
draft: true | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
- name: Upload Release Asset Wheel | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
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_content_type: application/x-wheel+zip | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
- name: Upload Release Asset Source Dist | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
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_content_type: application/tar+gzip | ||
if: success() && steps.branch_name.outputs.SOURCE_TAG | ||
notify: | ||
runs-on: ubuntu-20.04 | ||
needs: release | ||
steps: | ||
- name: action-slack | ||
uses: 8398a7/[email protected] | ||
with: | ||
status: ${{ needs.run.result }} | ||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.distutils.bdist_wheel] | ||
universal = true |