Skip to content

Commit

Permalink
Fix CI (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cariad Eccleston authored Jan 23, 2021
1 parent 9bf8d0e commit 330189b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 90 deletions.
89 changes: 80 additions & 9 deletions .github/workflows/on-push.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
container: cariad/ci:1.3.0
name: Build
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

Expand All @@ -19,18 +18,13 @@ jobs:
with:
key: ${{ runner.os }}-venv-${{ hashFiles('Pipfile.lock') }}
path: ~/.local/share/virtualenvs
restore-keys: |
${{ runner.os }}-venv-

- if: steps.cache-venv.outputs.cache-hit != 'true'
name: Create virtual environment
run: pipenv sync --dev

- name: Version
run: echo "${GITHUB_REF##*/}" > wev/VERSION

- name: Build
run: pipenv run ./build.sh
run: pipenv run ./build.sh "${GITHUB_REF##*/}"

- name: Archive distributable
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -61,8 +55,6 @@ jobs:
with:
key: ${{ runner.os }}-venv-${{ hashFiles('Pipfile.lock') }}
path: ~/.local/share/virtualenvs
restore-keys: |
${{ runner.os }}-venv-

- if: steps.cache-venv.outputs.cache-hit != 'true'
name: Create virtual environment
Expand Down Expand Up @@ -140,3 +132,82 @@ jobs:
run: |
wev --version | tee version.tmp
grep -qF "${GITHUB_REF##*/}" version.tmp
publish_documentation:
container: cariad/ci:1.3.0
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
S3_PATH: s3://wevcliapp-bucket-1hhoffdc0ib9x
if: startsWith(github.ref, 'refs/tags')
name: Update wevcli.app
needs:
- test_cli
- test_code
- test_docs
runs-on: ubuntu-20.04
steps:
- name: Download docs
uses: actions/download-artifact@v2
with:
name: docs
- name: Publish
run: aws s3 sync --delete . ${S3_PATH:?}


publish_to_github:
if: startsWith(github.ref, 'refs/tags')
name: Publish to GitHub release
needs:
- test_cli
- test_code
- test_docs
runs-on: ubuntu-20.04
steps:
- name: Download build distributable
uses: actions/download-artifact@v2
with:
name: distributable

- name: Get path to distributable
run: echo "DISTRIBUTABLE=$(ls *.whl)" >> $GITHUB_ENV

- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.2
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Publish
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/x-wheel+zip
asset_name: ${{ env.DISTRIBUTABLE }}
asset_path: ${{ env.DISTRIBUTABLE }}
upload_url: ${{ steps.get_release.outputs.upload_url }}


publish_to_pypi:
if: startsWith(github.ref, 'refs/tags')
name: Publish to PyPI
needs:
- test_cli
- test_code
- test_docs
runs-on: ubuntu-20.04
steps:
- name: Download build distributable
uses: actions/download-artifact@v2
with:
name: distributable
path: dist

- name: Publish
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
81 changes: 0 additions & 81 deletions .github/workflows/on-release.yml

This file was deleted.

1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash -e
echo "${1:?}" > wev/VERSION
rm -rf dist
python setup.py bdist_wheel
rm -rf build
Expand Down

0 comments on commit 330189b

Please sign in to comment.