-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (144 loc) · 4.24 KB
/
build.yml
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
name: Check and Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
release:
types: [released]
permissions: read-all
jobs:
build-executable:
name: Build binary for linux
runs-on: ubuntu-latest
steps:
- name: Install Apt packages
id: cache-apt
uses: awalsh128/cache-apt-pkgs-action@latest
with:
execute_install_scripts: true
packages: libfuse-dev
version: 1.0
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Nuitka ccache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.nuitka
key: ${{ github.job }}-ccache-ubuntu-latest
- name: Build with nuitka
run: |
pip install -r requirements.txt wheel nuitka
mkdir -p dist
NUITKA_CACHE_DIR="${{ github.workspace }}/.nuitka" \
python -m nuitka \
--enable-plugin=pylint-warnings \
--onefile \
--lto=yes \
--assume-yes-for-downloads \
--remove-output \
--output-dir=dist \
--output-filename=rmufuse \
remarkable_update_fuse/__main__.py
- uses: actions/upload-artifact@v4
with:
name: rmufuse
path: dist
if-no-files-found: error
build-wheel:
name: Build wheel with python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python:
- '3.11'
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install build tool
run: pip install build
- name: Building package
run: python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: pip-wheel-${{ matrix.python }}
path: dist/*
if-no-files-found: error
build-sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install build tool
run: pip install build
- name: Building package
run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: pip-sdist
path: dist/*
if-no-files-found: error
publish:
name: Publish to PyPi
if: github.repository == 'Eeems-Org/remarkable-update-fuse' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
needs: [build-sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
environment:
name: pypi
url: https://pypi.org/p/remarkable_update_fuse
steps:
- name: Download pip packages
id: download
uses: actions/download-artifact@v4
with:
name: pip-sdist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ steps.download.outputs.download-path }}
skip-existing: true
release:
name: Add ${{ matrix.artifact }} release
if: github.repository == 'Eeems-Org/remarkable-update-fuse' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
needs: [build-executable build-wheel]
runs-on: ubuntu-latest
strategy:
matrix:
artifact:
- 'rmufuse'
- 'pip-sdist'
- 'pip-wheel-3.11'
permissions:
contents: write
steps:
- name: Download executable
id: download
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
- name: Upload to release
run:
find "$FOLDER" -type f | xargs -rI{} hub release edit --attach {} "$TAG"
env:
FOLDER: ${{ steps.download.outputs.download-path }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
TAG: ${{ github.event.release.tag_name }}