Repository navigation
141 lines (114 loc) · 3.87 KB
/
Copy pathpublish.yml
File metadata and controls
141 lines (114 loc) · 3.87 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
name: Publish
on:
release:
types: [created]
workflow_dispatch:
inputs:
dry_run:
description: "Dry run: build and test everything, but skip publishing to PyPI, GHCR, and GitHub releases"
type: boolean
default: true
jobs:
build-python-package:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"
- uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
- name: Build
run: uv build --no-sources
- name: Upload dists
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
if-no-files-found: error
publish-python-package:
needs: build-python-package
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download dists
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
if: github.event_name == 'release' || inputs.dry_run == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
windows-installer:
runs-on: windows-latest
needs: build-python-package
steps:
- uses: actions/checkout@v7
- name: Sanitize version tag
id: tag
shell: bash
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
- name: Install dependencies
run: uv pip install --system ".[gui]" pyinstaller
- name: Install Inno Setup
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install innosetup -y --allow-unofficial --force
- name: Run PyInstaller
run: pyinstaller ./deeplc.spec --clean --noconfirm
- name: Test built executable
run: dist/deeplc/deeplc.exe predict --help
- name: Run Inno Setup
run: ISCC.exe ./deeplc_innosetup.iss /DAppVersion=${{ steps.tag.outputs.tag }}
- name: Upload installer artifact
uses: actions/upload-artifact@v7
with:
name: windows-installer
path: dist/*.exe
- name: Upload installer to release
if: github.event_name == 'release' || inputs.dry_run == 'false'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file_glob: true
file: dist/*.exe
build-docker-image:
runs-on: ubuntu-latest
needs: build-python-package
permissions:
packages: write
steps:
- uses: actions/checkout@v7
- name: Sanitize image tag
id: tag
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
if: github.event_name == 'release' || inputs.dry_run == 'false'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to ghcr.io
uses: docker/build-push-action@v7
with:
context: .
file: docker/Dockerfile
push: ${{ github.event_name == 'release' || inputs.dry_run == 'false' }}
tags: |
ghcr.io/compomics/deeplc:${{ steps.tag.outputs.tag }}
${{ github.event_name == 'release' && 'ghcr.io/compomics/deeplc:latest' || '' }}
- name: Test Docker image
if: github.event_name == 'release' || inputs.dry_run == 'false'
run: docker run --rm ghcr.io/compomics/deeplc:${{ steps.tag.outputs.tag }} deeplc --help