Skip to content

Commit

Permalink
Merge pull request #8 from homeylab/share_work
Browse files Browse the repository at this point in the history
Share work
  • Loading branch information
pchang388 authored Oct 2, 2023
2 parents 9eedfa5 + 51308bb commit 1af30c0
Show file tree
Hide file tree
Showing 26 changed files with 1,118 additions and 210 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/always.pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
100 changes: 100 additions & 0 deletions .github/workflows/on_pr_merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# needs: [tests] # require tests to pass before deploy runs

name: Build and Push

# on:
# push:
# # Pattern matched against refs/tags
# tags:
# - '**' # Push events to every tag including hierarchical tags like v1.0/beta

on:
pull_request:
types:
- closed
branches:
- master

jobs:
docker_deploy:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Dockerhub
run: docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: make docker_build
- name: Push Docker image
run: make docker_push
pypi_deploy:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Set tag version
run: |
TAG=$(cat Makefile | grep -E ^IMAGE_TAG=[0-9].[0-9].[0-9])
echo "VERSION=${TAG}" >> $GITHUB_ENV
echo "version from Makefile is: ${VERSION}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Update Release tag
run: sed -i 's/^version = [^ ]*/version = ${VERSION}/' setup.cfg
- name: Build package
run: make build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
create_tag:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
needs:
- docker_deploy
- pypi_deploy
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: Set tag version
run: |
TAG=$(cat Makefile | grep -E ^IMAGE_TAG=[0-9].[0-9].[0-9])
echo "VERSION=${TAG}" >> $GITHUB_ENV
echo "version from Makefile is: ${VERSION}"
- name: Create tag
uses: anothrNick/github-tag-action@1.64.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
PRERELEASE: true
CUSTOM_TAG: ${VERSION}
create_release:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
needs:
- create_tag
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set tag version
run: |
TAG=$(cat Makefile | grep -E ^IMAGE_TAG=[0-9].[0-9].[0-9])
echo "VERSION=${TAG}" >> $GITHUB_ENV
echo "version from Makefile is: ${VERSION}"
- uses: ncipollo/release-action@v1
with:
tag: ${VERSION}
generateReleaseNotes: true
# docker image tag latest
32 changes: 32 additions & 0 deletions .github/workflows/on_pr_open.docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test Builds

on:
pull_request:
branches: [ "main" ]

jobs:
docker_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare Makefile
run: sed -i 's/^IMAGE_TAG=[^ ]*/IMAGE_TAG=${{github.run_id}}/' Makefile
- name: Build the Docker image
run: make docker_build
pip_build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Prepare setup.cfg
run: sed -i 's/^version = [^ ]*/version = ${{github.run_id}}/' setup.cfg
- name: Test Build of Package
run: make build
#- name: Upload to TestPypi
#- name: Test install from TestPypi
Loading

0 comments on commit 1af30c0

Please sign in to comment.