Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
timmo001 committed Apr 1, 2024
1 parent b106c56 commit 7bd7407
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 164 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "Build"

# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
uses: timmo001/workflows/.github/workflows/build-python-linux.yml@master
67 changes: 0 additions & 67 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: "CodeQL"

# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 12 * * 4"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
actions: read
contents: read
security-events: write

jobs:
codeql-analyze-python:
uses: timmo001/workflows/.github/workflows/codeql-python.yml@master
14 changes: 14 additions & 0 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: "Dependabot - Auto-merge"

# yamllint disable-line rule:truthy
on:
pull_request_target:

permissions:
pull-requests: write
contents: write

jobs:
dependabot-automerge:
uses: timmo001/workflows/.github/workflows/dependabot-automerge-any.yml@master
13 changes: 13 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "Dependency Review"

# yamllint disable-line rule:truthy
on:
- pull_request

permissions:
contents: read

jobs:
dependency-review:
uses: timmo001/workflows/.github/workflows/depedency-review.yml@master
115 changes: 98 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,116 @@
---
name: Deploy
name: "Deploy"

# yamllint disable-line rule:truthy
on:
release:
types:
- published
workflow_run:
workflows: ["CI"]
branches: [master]
types:
- completed
workflow_dispatch:

env:
MODULE_NAME: aiolyric

jobs:
deploy:
name: 🚀 Linux - Deploy Module
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
with:
ref: "master"
token: ${{ secrets.PUSH_TOKEN }}
- name: 🏗 Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"
- name: Install dependencies
python-version: "3.12"
architecture: "x64"
cache: "pip"
- name: 🏗 Install setuptools, wheel, twine, click, twisted, incremental
run: |
python -m pip install --upgrade setuptools wheel twine click twisted incremental
- name: 🔢 Get old version
id: get-version-old
run: |
python -m pip install .
# Read version from _version.py
result=$(python <<EOF
from ${{ env.MODULE_NAME }}._version import __version__
print(__version__.public())
EOF
)
echo "version=$result" >> $GITHUB_OUTPUT
- name: 🔢 Set correct vertion - Developement
if: ${{ github.event_name != 'release' }}
run: |
# If version does not contain dev, add it
if [[ ! "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then
python -m incremental.update ${{ env.MODULE_NAME }} --dev
fi
- name: 🔢 Set correct vertion - Release
if: ${{ github.event_name == 'release' }}
run: |
# If version contains dev*, remove it
if [[ "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then
NEW_VERSION=$(echo "${{ steps.get-version-old.outputs.version }}" | sed 's/.dev.*//')
python -m incremental.update ${{ env.MODULE_NAME }} --newversion $NEW_VERSION
fi
- name: 🔢 Get current version
id: get-version-current
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
result=$(python <<EOF
from ${{ env.MODULE_NAME }}._version import __version__
print(__version__.public())
EOF
)
echo "version=$result" >> $GITHUB_OUTPUT
- name: ⤵️ Pull latest changes from GitHub
run: |
git pull --ff
- name: 🖊 Commit
uses: stefanzweifel/[email protected]
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
with:
commit_message: |
Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-current.outputs.version }}
- name: 🏗 Install package
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
- name: 🔢 Increment version - Developement
if: ${{ github.event_name != 'release' }}
run: |
python -m incremental.update ${{ env.MODULE_NAME }} --dev
- name: 🔢 Increment version - Release
if: ${{ github.event_name == 'release' }}
run: |
python -m incremental.update ${{ env.MODULE_NAME }} --patch
python -m incremental.update ${{ env.MODULE_NAME }} --dev
- name: 🔢 Get new version
id: get-version-new
run: |
result=$(python <<EOF
from ${{ env.MODULE_NAME }}._version import __version__
print(__version__.public())
EOF
)
echo "version=$result" >> $GITHUB_OUTPUT
- name: ⤵️ Pull latest changes from GitHub
run: |
git pull --ff
- name: 🖊 Commit
uses: stefanzweifel/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
with:
commit_message: |
Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-new.outputs.version }}
15 changes: 5 additions & 10 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Sync labels
name: "Sync labels"

# yamllint disable-line rule:truthy
on:
Expand All @@ -8,15 +8,10 @@ on:
- master
paths:
- .github/labels.yml
schedule:
- cron: "34 5 * * *"
workflow_dispatch:

jobs:
labels:
name: ♻️ Sync labels
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4
- name: 🚀 Run Label Syncer
uses: micnncim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: timmo001/workflows/.github/workflows/labels.yml@master
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: "Lint"

# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint-jsonlint:
uses: timmo001/workflows/.github/workflows/lint-jsonlint.yml@master
lint-markdown-links:
uses: timmo001/workflows/.github/workflows/lint-markdown-links.yml@master
lint-markdownlint:
uses: timmo001/workflows/.github/workflows/lint-markdownlint.yml@master
lint-prettier:
uses: timmo001/workflows/.github/workflows/lint-prettier.yml@master
with:
file-types: "{json,yml,yaml}"
lint-pylint:
uses: timmo001/workflows/.github/workflows/lint-pylint.yml@master
with:
module-name: aiolyric
lint-ruff:
uses: timmo001/workflows/.github/workflows/lint-ruff.yml@master
lint-yamllint:
uses: timmo001/workflows/.github/workflows/lint-yamllint.yml@master
21 changes: 0 additions & 21 deletions .github/workflows/lock.yml

This file was deleted.

13 changes: 4 additions & 9 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
---
name: Release Drafter
name: "Release Drafter"

# yamllint disable-line rule:truthy
on:
push:
branches:
- master
workflow_dispatch:

jobs:
update_release_draft:
name: ✏️ Draft release
runs-on: ubuntu-latest
steps:
- name: 🚀 Run Release Drafter
uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-drafter:
uses: timmo001/workflows/.github/workflows/release-drafter.yml@master
Loading

0 comments on commit 7bd7407

Please sign in to comment.