-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from unixorn/prep-for-release
Prep for release
- Loading branch information
Showing
5 changed files
with
101 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This workflow will build a Python wheel, a Docker image containing the CLI tool and publish both to PyPi and DockerHub | ||
|
||
name: Build and publish | ||
|
||
# Run only when pushing a Git version tag | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-wheel: | ||
name: Build and publish Python package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: "poetry" | ||
|
||
- name: Bump version and build package | ||
run: | | ||
# Extract the package version from the latest git tag, removing the leading `v` | ||
VERSION=$(git describe --tags --abbrev=0 | sed --quiet --regexp-extended 's/v(.*)/\1/p') | ||
echo "$VERSION" | ||
# Set package version using poetry CLI | ||
poetry version "$VERSION" | ||
poetry build | ||
- name: Upload package | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Python package | ||
path: dist/ | ||
if-no-files-found: error | ||
|
||
- name: Publish wheel | ||
run: | | ||
poetry publish --username __token__ --password ${{ secrets.PYPI_PASSWORD }} | ||
docker-image: | ||
needs: build-wheel | ||
name: Build and publish Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download Python package | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: Python package | ||
path: dist/ | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
build-args: | | ||
application_version: ${{ github.ref_name }} | ||
push: true | ||
platforms: linux/arm64,linux/amd64,linux/arm/v7 | ||
tags: unixorn/ha-franklin:${{ github.ref_name }} |
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
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