-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (128 loc) · 6.27 KB
/
Copy pathrelease.yml
File metadata and controls
153 lines (128 loc) · 6.27 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
name: Build and Release Packages
on:
push:
branches:
- main
- master
permissions:
contents: write
jobs:
build:
if: contains(github.event.head_commit.message, '[RELEASE]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install gettext
run: sudo apt-get update && sudo apt-get install -y gettext
- name: Compile translations
run: |
# Compilar traducciones de la carpeta locale al paquete
mkdir -p appinstall/usr/share/locale/en/LC_MESSAGES/
msgfmt locale/en/LC_MESSAGES/appinstall.po -o appinstall/usr/share/locale/en/LC_MESSAGES/appinstall.mo
# También compilar en la carpeta locale raíz por si acaso
msgfmt locale/en/LC_MESSAGES/appinstall.po -o locale/en/LC_MESSAGES/appinstall.mo
- name: Sync source files
run: |
# Aplicación
mkdir -p appinstall/usr/share/appinstall/
cp -r src/ appinstall/usr/share/appinstall/
cp start.py appinstall/usr/share/appinstall/
cp styles.css appinstall/usr/share/appinstall/
cp appimage.png appinstall/usr/share/appinstall/
# Integración del sistema
mkdir -p appinstall/usr/share/applications/
cp es.inled.AppInstall.desktop appinstall/usr/share/applications/
mkdir -p appinstall/usr/share/metainfo/
cp es.inled.AppInstall.metainfo.xml appinstall/usr/share/metainfo/
# Iconos
mkdir -p appinstall/usr/share/icons/hicolor/512x512/apps/
cp es.inled.AppInstall.png appinstall/usr/share/icons/hicolor/512x512/apps/
mkdir -p appinstall/usr/share/pixmaps/
cp es.inled.AppInstall.png appinstall/usr/share/pixmaps/
- name: Set up permissions
run: |
chmod -R 755 appinstall/usr
chmod 755 appinstall/DEBIAN/postinst
chmod 644 appinstall/DEBIAN/control
- name: Build .deb package
run: |
PACKAGE_NAME=$(grep '^Package:' appinstall/DEBIAN/control | cut -d' ' -f2)
VERSION=$(grep '^Version:' appinstall/DEBIAN/control | cut -d' ' -f2)
ARCH=$(grep '^Architecture:' appinstall/DEBIAN/control | cut -d' ' -f2)
DEB_NAME="${PACKAGE_NAME}_${VERSION}_${ARCH}.deb"
dpkg-deb --root-owner-group --build appinstall "$DEB_NAME"
echo "DEB_NAME=$DEB_NAME" >> $GITHUB_ENV
echo "TAG_NAME=v$VERSION" >> $GITHUB_ENV
- name: Install alien
run: sudo apt-get update && sudo apt-get install -y alien
- name: Build .rpm package
run: |
sudo alien --to-rpm --scripts --keep-version "${{ env.DEB_NAME }}"
# Alien converts underscores to hyphens and might change name slightly
RPM_NAME=$(ls *.rpm | head -n 1)
echo "RPM_NAME=$RPM_NAME" >> $GITHUB_ENV
- name: Build Arch Linux package
run: |
VERSION=$(grep '^Version:' appinstall/DEBIAN/control | cut -d' ' -f2)
ARCH_PKG_NAME="appinstall-${VERSION}-1-any.pkg.tar.zst"
# English: Create workspace directory for Arch package building
# Español: Crear el directorio de trabajo para la construcción del paquete Arch
mkdir -p archpkg/usr/
cp -r appinstall/usr/ archpkg/
# English: Calculate folder size in bytes and get build timestamp
# Español: Calcular el tamaño de la carpeta en bytes y obtener la fecha de compilación
SIZE=$(du -sb archpkg/usr | cut -f1)
BUILDDATE=$(date +%s)
# English: Write PKGINFO metadata file for Arch pacman package manager
# Español: Escribir el archivo de metadatos PKGINFO para el gestor de paquetes pacman de Arch
printf "%s\n" \
"# Generated by GitHub Actions" \
"pkgname = appinstall" \
"pkgver = ${VERSION}-1" \
"pkgdesc = Simple package installer for Linux" \
"url = https://github.com/InledGroup/appinstall" \
"builddate = ${BUILDDATE}" \
"packager = Jaime Gonzalez Herraiz <CONTACTO@INLED.ES>" \
"size = ${SIZE}" \
"arch = any" \
"license = GPL3" \
"depend = python" \
"depend = python-gobject" \
"depend = libadwaita" \
"depend = gtk4" > archpkg/.PKGINFO
# English: Build the .pkg.tar.zst archive with maximum compression level
# Español: Construir el archivo .pkg.tar.zst con el nivel de compresión máximo
cd archpkg
tar --owner=0 --group=0 -cf - .PKGINFO usr | zstd -z -19 > "../${ARCH_PKG_NAME}"
cd ..
echo "ARCH_PKG_NAME=${ARCH_PKG_NAME}" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.DEB_NAME }}
${{ env.RPM_NAME }}
${{ env.ARCH_PKG_NAME }}
tag_name: ${{ env.TAG_NAME }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger Repo Update
if: success()
run: |
# English: Build public release download URLs for all three package formats
# Español: Construir las URLs públicas de descarga de la release para los tres formatos de paquetes
DEB_URL="https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/${{ env.DEB_NAME }}"
RPM_URL="https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/${{ env.RPM_NAME }}"
ARCH_URL="https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/${{ env.ARCH_PKG_NAME }}"
echo "Disparando actualización en InledGroup/apt..."
echo "DEB: $DEB_URL"
echo "RPM: $RPM_URL"
echo "ARCH: $ARCH_URL"
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.APT_REPO_TOKEN }}" \
https://api.github.com/repos/InledGroup/apt/dispatches \
-d "{\"event_type\": \"package_upload\", \"client_payload\": {\"deb_url\": \"$DEB_URL\", \"rpm_url\": \"$RPM_URL\", \"arch_url\": \"$ARCH_URL\"}}"