File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Ignore everything
2+ **
3+
4+ # Except what we need
5+ ! bot
6+ ! pyproject.toml
7+ ! uv.lock
Original file line number Diff line number Diff line change 11name : Build and deploy a Docker image
22
33on :
4- workflow_run :
5- workflows : ["Linting"]
6- branches :
7- - master
8- types :
9- - completed
10-
11- concurrency :
12- group : ${{ github.workflow }}-${{ github.ref }}
13- cancel-in-progress : true
14-
4+ workflow_call :
5+ inputs :
6+ sha-tag :
7+ description : " A short-form SHA tag for the commit that triggered this workflow"
8+ required : true
9+ type : string
1510
1611jobs :
1712 build :
18- if : github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
1913 name : Build & Push to GHCR
2014 runs-on : ubuntu-latest
2115 steps :
22- - name : Create a short SHA tag
23- id : sha_tag
24- run : |
25- tag=$(cut -c 1-7 <<< $GITHUB_SHA)
26- echo "::set-output name=tag::$tag"
27-
2816 - name : Checkout code
2917 uses : actions/checkout@v6
3018
@@ -43,11 +31,11 @@ jobs:
4331 with :
4432 context : .
4533 file : Dockerfile
46- push : true
34+ push : ${{ github.ref == 'refs/heads/master' }}
4735 cache-from : type=registry,ref=ghcr.io/fisher60/friendo-bot:latest
4836 cache-to : type=inline
4937 tags : |
5038 ghcr.io/fisher60/friendo-bot:latest
51- ghcr.io/fisher60/friendo-bot:${{ steps.sha_tag.outputs. tag }}
39+ ghcr.io/fisher60/friendo-bot:${{ inputs.sha- tag }}
5240 build-args : |
5341 git_sha=${{ github.sha }}
Original file line number Diff line number Diff line change 11name : Linting
22
33on :
4- push :
5- branches :
6- - master
7- - develop
8- pull_request :
9-
10- concurrency :
11- group : ${{ github.workflow }}-${{ github.ref }}
12- cancel-in-progress : true
4+ workflow_call :
135
146jobs :
157 lint :
Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ pull_request :
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress : true
12+
13+ jobs :
14+ generate-sha-tag :
15+ runs-on : ubuntu-latest
16+ outputs :
17+ sha-tag : ${{ steps.sha-tag.outputs.sha-tag }}
18+ steps :
19+ - name : Create short SHA to be used as a container tag
20+ id : sha-tag
21+ run : |
22+ tag=$(cut -c 1-7 <<< $GITHUB_SHA)
23+ echo "sha-tag=$tag" >> $GITHUB_OUTPUT
24+
25+ lint :
26+ uses : ./.github/workflows/linting.yml
27+
28+ build-deploy :
29+ uses : ./.github/workflows/build.yml
30+ needs :
31+ - lint
32+ - generate-sha-tag
33+ with :
34+ sha-tag : ${{ needs.generate-sha-tag.outputs.sha-tag }}
35+ secrets : inherit
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ ENV PATH="/build/.venv/bin:$PATH"
3333
3434# Copy the source code in last to optimize rebuilding the image
3535WORKDIR /app
36- COPY bot .
36+ COPY . .
3737
3838ENTRYPOINT ["python" , "-m" ]
3939CMD ["bot" ]
Original file line number Diff line number Diff line change 11import logging
2+ import tomllib
23from os import environ
4+ from pathlib import Path
35
46log = logging .getLogger (__name__ )
57
3436
3537log .info ("Using %s for backend..." , FRIENDO_API_URL )
3638
37- VERSION = "1.2"
39+ with Path ("pyproject.toml" ).open ("rb" ) as f :
40+ pyproject = tomllib .load (f )
41+
42+ VERSION = pyproject ["project" ]["version" ]
3843
3944GITHUB_REPO = "https://github.com/fisher60/friendo-bot"
4045
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ authors = [
66license = {text = " MIT" }
77requires-python = " ~=3.14.0"
88name = " friendo-bot"
9- version = " 0.0.1 "
9+ version = " 1.2 "
1010dependencies = [
1111 " aiodns~=4.0.0" ,
1212 " aiofiles~=25.1.0" ,
You can’t perform that action at this time.
0 commit comments