Skip to content

Merge pull request #64 from sanger/dependabot/pip/hatchling-1.13.0 #29

Merge pull request #64 from sanger/dependabot/pip/hatchling-1.13.0

Merge pull request #64 from sanger/dependabot/pip/hatchling-1.13.0 #29

name: Automated build, test, release and push
on:
push:
branches:
- develop
- master
env:
IMAGE_NAME: ${{ github.repository }}/${{ github.event.repository.name }}
jobs:
build_test_release_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nelonoel/[email protected]
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install pipenv
run: |
pip install pipenv
- name: Install dependencies
run: |
pipenv sync --dev --system
# Actually run our build
- name: Create Build
run: python -m build
# Create a release tag based on the branch name and .release-version file
- name: Set release tag
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# On the develop branch this might create RELEASE_VERSION=2.4.6-987654321-develop
# On the master branch this would then only create RELEASE_VERSION=2.4.6
run: echo "RELEASE_VERSION=$(printf -- '%s%s\n' $(cat .release-version) $([ ${BRANCH_NAME} = "develop" ] && printf -- '-%s-develop' ${GITHUB_RUN_ID} || echo ""))" >> $GITHUB_ENV
# Create a GitHub release with the release asset as an artifact
- name: Create release and upload release.tar.gz
uses: ncipollo/[email protected]
with:
name: ${{ env.RELEASE_VERSION }}
tag: v${{ env.RELEASE_VERSION }}
prerelease: ${{ !(github.ref == 'refs/heads/master') }}
commit: ${{ github.sha }}
artifacts: dist/*.tar.gz
artifactErrorsFailBuild: true