Version and Deploy #73
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: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- 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 and Push Docker | |
run: | | |
docker buildx build . --build-arg TYPE=release --build-arg VERSION=${VERSION} --tag fmtr/${NAME}:v${VERSION} --tag fmtr/${NAME}:latest --push --platform linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x |