Version and Deploy #60
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
name: Version and Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
VERSION: ${{ github.event.inputs.version }} | |
NAME: ${{ github.event.repository.name }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Tools | |
run: | | |
pip install twine pyyaml | |
- name: Docker Login | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
run: | | |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USER --password-stdin | |
- name: Increment Version | |
run: | | |
git config --global user.name 'Frontmatter Actions' | |
git config --global user.email '[email protected]' | |
echo -n ${VERSION} > ${NAME}/version | |
python ha/addon/update_version.py ${VERSION} | |
git add ${NAME}/version | |
git add ha/addon/config.yaml | |
git commit -am "Increment version number to ${VERSION} for release" | |
git push | |
git tag v${VERSION} | |
git push --tags | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true | |
tag: v${{ github.event.inputs.version }} | |
- name: Build Wheel | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Push Wheel | |
env: | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
TWINE_USERNAME: __token__ | |
run: | | |
twine upload dist/* | |
- name: Build Docker | |
run: | | |
docker build . --build-arg TYPE=release --build-arg VERSION=${VERSION} --tag fmtr/${NAME}:v${VERSION} | |
docker tag fmtr/${NAME}:v${VERSION} fmtr/${NAME}:latest | |
- name: Push Docker | |
run: | | |
docker push --all-tags fmtr/${NAME} |