-
Notifications
You must be signed in to change notification settings - Fork 1
165 lines (139 loc) · 4.5 KB
/
publish.yml
File metadata and controls
165 lines (139 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: 'Publish'
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
with:
fetch-depth: 100
fetch-tags: true
- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version: 'latest'
- name: Install lint
shell: bash
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
if [ ! -f "commitlint.config.js" ]; then
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
fi
- name: Lint Commit Message
if: github.event_name == 'push'
shell: bash
run: commitlint --from=HEAD~2 --verbose
- name: Lint Pull Request
if: github.event_name == 'pull_request'
shell: bash
run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: "Get Previous tag"
id: previoustagold
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Conventional Changelog Action
id: changelog
if: github.ref_name == 'main'
uses: TriPSs/conventional-changelog-action@v6
with:
github-token: ${{ github.token }}
git-url: ${{ github.server_url != 'https://github.com' && 'git.yusufali.ca' || 'github.com' }}
tag-prefix: ""
output-file: false
skip-version-file: true
skip-commit: true
skip-ci: false
skip-tag: ${{ github.ref_name != 'main' }}
fallback-version: ${{ steps.previoustagold.outputs.tag }}
codepublish:
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Install git
if: github.ref_name == 'main' && github.server_url != 'https://github.com'
shell: bash
env:
TOKEN: ${{ secrets.GIT_SERVC_TOKEN }}
URL: github.com/${{ github.repository }}.git
run: |
sudo apt-get install -y git
git checkout main
git push https://drgroot:${TOKEN}@${URL} main
git push https://drgroot:${TOKEN}@${URL} --tags
dockerpublish:
runs-on: ubuntu-latest
needs: version
steps:
- name: Check out code
uses: actions/checkout@v5
with:
submodules: true
fetch-tags: true
- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.ref_name == 'main'
with:
username: ${{ secrets.DOCKER_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKER_PUBLIC_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.ref_name == 'main' }}
tags: yusufali/servc:latest,yusufali/servc:${{ steps.previoustag.outputs.tag }}
packagepublish:
runs-on: ubuntu-latest
needs: version
steps:
- name: Check out code
uses: actions/checkout@v5
with:
submodules: true
fetch-depth: 0
fetch-tags: true
- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1
- uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Setup Version
env:
TAG: ${{ steps.previoustag.outputs.tag }}
run: |
sed -i "s/version = .*/version = \"$TAG\"/g" pyproject.toml
cat pyproject.toml
- name: Build package
run: python -m build
- name: Publish package
if: github.ref_name == 'main'
run: |
unset DBUS_SESSION_BUS_ADDRESS
python -m twine upload --verbose dist/* --non-interactive -u__token__ -p${{ secrets.PYPI_TOKEN }}