Skip to content

Commit 7cfd4db

Browse files
teste 13
1 parent e6acd74 commit 7cfd4db

File tree

2 files changed

+28
-57
lines changed

2 files changed

+28
-57
lines changed

.github/workflows/build-linux-legacy.yml

Lines changed: 27 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,33 @@ on:
44
push:
55
branches:
66
- linux-release
7-
tags:
8-
- "*"
7+
tags: [ "*" ]
98
paths:
10-
- "DocViewerDesktop/**"
9+
- 'DocViewerDesktop/**'
1110
workflow_dispatch:
1211

1312
env:
14-
APP_NAME: docviewer
13+
VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('{0}-dev', github.run_number) }}
1514

1615
jobs:
1716
build-linux:
18-
name: Build Linux (.deb)
17+
name: Build Linux
1918
runs-on: ubuntu-latest
2019

2120
steps:
22-
- uses: actions/checkout@v4
21+
- name: Checkout
22+
uses: actions/checkout@v4
2323

24-
- uses: actions/setup-python@v4
24+
- name: Setup Python
25+
uses: actions/setup-python@v4
2526
with:
2627
python-version: "3.9"
2728

28-
- name: Set version
29-
run: |
30-
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
31-
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
32-
else
33-
echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
34-
fi
35-
3629
- name: Install dependencies
3730
run: |
3831
python -m pip install --upgrade pip
3932
pip install -r DocViewerDesktop/requirements.txt
4033
pip install pyinstaller
41-
4234
- name: Build with PyInstaller (Linux)
4335
run: |
4436
pyinstaller --noconsole --name DocViewer \
@@ -50,40 +42,29 @@ jobs:
5042
--hidden-import="editor.actions.file_actions" \
5143
--hidden-import="editor.actions.edit_actions" \
5244
DocViewerDesktop/main.py
53-
45+
5446
- name: Build .deb package
5547
run: |
5648
sudo apt-get update
5749
sudo apt-get install -y ruby ruby-dev build-essential
5850
sudo gem install --no-document fpm
59-
6051
mkdir -p package/opt/docviewer
61-
mkdir -p package/usr/bin
6252
mkdir -p package/usr/share/applications
6353
mkdir -p package/usr/share/icons/hicolor/256x256/apps
64-
6554
cp -r dist/DocViewer/* package/opt/docviewer/
6655
chmod +x package/opt/docviewer/DocViewer
67-
68-
cat <<'EOF' > package/usr/bin/docviewer
69-
#!/bin/sh
70-
exec /opt/docviewer/DocViewer "$@"
71-
EOF
72-
chmod +x package/usr/bin/docviewer
73-
7456
cp DocViewerDesktop/resources/icons_svg/doc_icon.png \
7557
package/usr/share/icons/hicolor/256x256/apps/docviewer.png
76-
7758
cat <<EOF > package/usr/share/applications/docviewer.desktop
7859
[Desktop Entry]
7960
Type=Application
8061
Name=DocViewer
81-
Exec=docviewer
62+
Exec=/opt/docviewer/DocViewer
8263
Icon=docviewer
8364
Terminal=false
8465
Categories=Utility;Office;
8566
EOF
86-
67+
8768
fpm -s dir -t deb \
8869
-n docviewer \
8970
-v "$VERSION" \
@@ -96,39 +77,31 @@ jobs:
9677
9778
mkdir -p artifacts
9879
mv docviewer_${VERSION}_amd64.deb artifacts/
99-
80+
10081
- name: Upload Linux artifact
10182
uses: actions/upload-artifact@v4
10283
with:
10384
name: linux-deb
10485
path: artifacts/*.deb
10586

10687
build-windows:
107-
name: Build Windows (zip)
88+
name: Build Windows
10889
runs-on: windows-latest
10990

11091
steps:
111-
- uses: actions/checkout@v4
92+
- name: Checkout
93+
uses: actions/checkout@v4
11294

113-
- uses: actions/setup-python@v4
95+
- name: Setup Python
96+
uses: actions/setup-python@v4
11497
with:
11598
python-version: "3.9"
11699

117-
- name: Set version
118-
shell: bash
119-
run: |
120-
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
121-
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
122-
else
123-
echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
124-
fi
125-
126100
- name: Install dependencies
127101
run: |
128102
python -m pip install --upgrade pip
129103
pip install -r DocViewerDesktop/requirements.txt
130104
pip install pyinstaller
131-
132105
- name: Build with PyInstaller (Windows)
133106
shell: bash
134107
run: |
@@ -141,34 +114,32 @@ jobs:
141114
--hidden-import="editor.actions.file_actions" \
142115
--hidden-import="editor.actions.edit_actions" \
143116
DocViewerDesktop/main.py
144-
145117
- name: Zip Windows build
146118
shell: pwsh
147119
run: |
148120
mkdir artifacts
149-
Compress-Archive -Path dist\DocViewer\* `
150-
-DestinationPath artifacts\docviewer-windows-${env:VERSION}.zip
151-
121+
Compress-Archive -Path dist\DocViewer -DestinationPath artifacts\docviewer-windows.zip
152122
- name: Upload Windows artifact
153123
uses: actions/upload-artifact@v4
154124
with:
155125
name: windows-zip
156-
path: artifacts/*.zip
126+
path: artifacts/docviewer-windows.zip
157127

158128
release:
159129
name: Create GitHub Release
160130
runs-on: ubuntu-latest
161131
needs: [build-linux, build-windows]
162132

163133
steps:
164-
- uses: actions/download-artifact@v4
134+
- name: Download artifacts
135+
uses: actions/download-artifact@v4
165136

166137
- name: Create Release
167138
id: create_release
168139
uses: actions/create-release@v1
169140
with:
170-
tag_name: v${{ env.VERSION }}
171-
release_name: "DocViewer v${{ env.VERSION }}"
141+
tag_name: ${{ env.VERSION }}
142+
release_name: "DocViewer ${{ env.VERSION }}"
172143
draft: false
173144
prerelease: true
174145
env:
@@ -178,8 +149,8 @@ jobs:
178149
uses: actions/upload-release-asset@v1
179150
with:
180151
upload_url: ${{ steps.create_release.outputs.upload_url }}
181-
asset_path: linux-deb/*.deb
182-
asset_name: docviewer-linux-amd64.deb
152+
asset_path: linux-deb/docviewer_${{ env.VERSION }}_amd64.deb
153+
asset_name: docviewer-linux.deb
183154
asset_content_type: application/vnd.debian.binary-package
184155
env:
185156
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -188,8 +159,8 @@ jobs:
188159
uses: actions/upload-release-asset@v1
189160
with:
190161
upload_url: ${{ steps.create_release.outputs.upload_url }}
191-
asset_path: windows-zip/*.zip
162+
asset_path: windows-zip/docviewer-windows.zip
192163
asset_name: docviewer-windows.zip
193164
asset_content_type: application/octet-stream
194165
env:
195-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

DocViewerDesktop/editor/actions/file_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def close_tab(self, index):
5757

5858
def renameTab(self, tab_index, tab_widget):
5959
"""Renomeia a aba especificada e o arquivo associado"""
60-
# Obtém o nome atual da aba e o caminho completo do arquivo
60+
6161
current_name = self.ui.tab_widget.tabText(tab_index)
6262
file_path = self.ui.open_files[tab_widget][0] # Caminho atual do arquivo
6363
current_dir = os.path.dirname(file_path) # Diretório atual do arquivo

0 commit comments

Comments
 (0)