-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add branch specifications to make sure that the actions are not both …
…run on the same release.
- Loading branch information
1 parent
fdbc6e3
commit 46950ce
Showing
2 changed files
with
257 additions
and
1 deletion.
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
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,164 @@ | ||
name: Release the Data Delivery System CLI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' #if a push with a version tag like v0.0.2 is recorded, trigger release and build | ||
branches: | ||
- '*' | ||
- '!master' | ||
|
||
jobs: | ||
|
||
ddsclirelease: | ||
name: Release DDS CLI | ||
runs-on: [ubuntu-latest] | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
${{ github.event.head_commit.message }} | ||
draft: true # change to false for production | ||
prerelease: false | ||
|
||
|
||
ddsclipypi: | ||
name: Release DDS CLI on PyPi | ||
needs: ddsclirelease | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
architecture: 'x64' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
pip install -r requirements.txt | ||
- name: Build binary wheel and source tarball | ||
id: build_wheel | ||
shell: bash | ||
run: | | ||
python -m build --sdist --wheel --outdir dist/ | ||
wheel=$(find ./dist -name "*.whl") | ||
wheelbase=$(basename $(find ./dist -name "*.whl")) | ||
echo ::set-output name=wheel::$wheel | ||
echo ::set-output name=wheelbase::$wheelbase | ||
- name: Publish to Python Package Index | ||
if: github.repository == 'ScilifelabDataCentre/dds_cli' | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} | ||
- name: Upload Wheel | ||
id: upload-wheel | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }} | ||
asset_path: ${{ steps.build_wheel.outputs.wheel }} | ||
asset_name: ${{ steps.build_wheel.outputs.wheelbase }} | ||
asset_content_type: application/x-wheel+zip | ||
|
||
ddsclibinaries: | ||
name: Build binary packages for the DDS CLI | ||
needs: ddsclirelease | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: macos-latest | ||
TARGET: MacOs_x86_64 | ||
CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_x86_64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch x86_64 --log-level INFO dds_cli/__init__.py | ||
OUT_FILE_NAME: dds_cli_macos_x86_64.exe | ||
ASSET_MIME: application/x-elf | ||
#- os: macos-latest #No virtual environment for this yet | ||
# TARGET: MacOs_arm64 | ||
# CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_arm64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch arm64 --log-level INFO dds_cli/__init__.py | ||
# OUT_FILE_NAME: dds_cli_macos_arm64.exe | ||
# ASSET_MIME: application/x-elf | ||
- os: windows-latest | ||
TARGET: Windows_x86_64 | ||
CMD_BUILD: PyInstaller -F -c -n dds_cli_win_x86_64.exe -i resources/scilifelab.ico --exclude-module=tests --log-level INFO dds_cli/__init__.py | ||
OUT_FILE_NAME: dds_cli_win_x86_64.exe | ||
ASSET_MIME: application/vnd.microsoft.portable-executable | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Python 3.9 setup | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
# architecture: 'x64' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install PyInstaller | ||
pip install -r requirements.txt | ||
- name: Building with PyInstaller for ${{matrix.TARGET}} | ||
run: ${{matrix.CMD_BUILD}} | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }} | ||
asset_path: ./dist/${{ matrix.OUT_FILE_NAME}} | ||
asset_name: ${{ matrix.OUT_FILE_NAME}} | ||
asset_content_type: ${{ matrix.ASSET_MIME}} | ||
|
||
ddsclidocumentation: | ||
name: Build the DDS CLI Documentation | ||
needs: ddsclirelease | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Make dependencies available to Docker container | ||
run: | | ||
cat requirements.txt requirements-dev.txt > ./docs/requirements.txt | ||
- name: Build the HTML documentation | ||
uses: matthiaszepper/sphinx-action-v4@latest | ||
with: | ||
container: latest | ||
pre-build-command: "pip install dds_cli" | ||
build-command: "make html" | ||
docs-folder: "docs/" | ||
- name: Build the pdf with Sphinx | ||
uses: matthiaszepper/sphinx-action-v4@pdflatex | ||
with: | ||
container: pdflatex | ||
build-command: "make latexpdf" | ||
docs-folder: "docs/" | ||
- name: Create an artifact of the previously built HTML | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: DocumentationHTML | ||
path: docs/_build/html/ | ||
- name: Create an artifact of the previously built pdf | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Documentation | ||
path: docs/_build/latex/datadeliverysystem.pdf | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }} | ||
asset_path: docs/_build/latex/datadeliverysystem.pdf | ||
asset_name: dds_cli_user_manual.pdf | ||
asset_content_type: application/pdf | ||
|
||
|