meteocat 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +45 -45
- package/.github/ISSUE_TEMPLATE/config.yml +8 -8
- package/.github/ISSUE_TEMPLATE/improvement.md +39 -39
- package/.github/ISSUE_TEMPLATE/new_function.md +41 -41
- package/.github/labels.yml +63 -63
- package/.github/workflows/autocloser.yaml +27 -27
- package/.github/workflows/close-on-label.yml +48 -48
- package/.github/workflows/force-sync-labels.yml +18 -18
- package/.github/workflows/hassfest.yaml +13 -13
- package/.github/workflows/publish-zip.yml +67 -67
- package/.github/workflows/release.yml +41 -41
- package/.github/workflows/stale.yml +63 -63
- package/.github/workflows/sync-gitlab.yml +107 -107
- package/.github/workflows/sync-labels.yml +21 -21
- package/.github/workflows/validate.yaml +16 -16
- package/.pre-commit-config.yaml +37 -37
- package/.releaserc +37 -37
- package/AUTHORS.md +13 -13
- package/CHANGELOG.md +954 -898
- package/README.md +207 -204
- package/conftest.py +11 -11
- package/custom_components/meteocat/__init__.py +298 -293
- package/custom_components/meteocat/condition.py +63 -59
- package/custom_components/meteocat/config_flow.py +613 -435
- package/custom_components/meteocat/const.py +132 -120
- package/custom_components/meteocat/coordinator.py +1040 -205
- package/custom_components/meteocat/helpers.py +58 -63
- package/custom_components/meteocat/manifest.json +25 -24
- package/custom_components/meteocat/options_flow.py +287 -277
- package/custom_components/meteocat/sensor.py +366 -4
- package/custom_components/meteocat/strings.json +1058 -867
- package/custom_components/meteocat/translations/ca.json +1058 -867
- package/custom_components/meteocat/translations/en.json +1058 -867
- package/custom_components/meteocat/translations/es.json +1058 -867
- package/custom_components/meteocat/version.py +1 -1
- package/custom_components/meteocat/weather.py +218 -218
- package/filetree.py +48 -48
- package/filetree.txt +79 -70
- package/hacs.json +8 -8
- package/images/daily_forecast_2_alerts.png +0 -0
- package/images/daily_forecast_no_alerts.png +0 -0
- package/images/diagnostic_sensors.png +0 -0
- package/images/dynamic_sensors.png +0 -0
- package/images/options.png +0 -0
- package/images/regenerate_assets.png +0 -0
- package/images/setup_options.png +0 -0
- package/images/system_options.png +0 -0
- package/info.md +11 -11
- package/package.json +22 -22
- package/poetry.lock +3222 -3222
- package/pyproject.toml +68 -68
- package/requirements.test.txt +3 -3
- package/setup.cfg +64 -64
- package/setup.py +10 -10
- package/tests/bandit.yaml +17 -17
- package/tests/conftest.py +19 -19
- package/tests/test_init.py +9 -9
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
name: Publish zip
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
publish-zip:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
permissions:
|
|
11
|
-
contents: write
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
# Paso 1: Checkout del repositorio completo
|
|
15
|
-
- name: Checkout repository
|
|
16
|
-
uses: actions/checkout@v4
|
|
17
|
-
with:
|
|
18
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
-
ref: master
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
|
|
22
|
-
# Paso 2: Obtener la versión del release recién publicado
|
|
23
|
-
- name: Get release version
|
|
24
|
-
id: release-version
|
|
25
|
-
run: |
|
|
26
|
-
version="${GITHUB_REF#refs/tags/v}"
|
|
27
|
-
echo "Release version: $version"
|
|
28
|
-
echo "version=$version" >> $GITHUB_OUTPUT
|
|
29
|
-
|
|
30
|
-
# Paso 3: Actualizar hacs.json con la última versión de Home Assistant
|
|
31
|
-
- name: Get latest Home Assistant version
|
|
32
|
-
id: ha-version
|
|
33
|
-
run: |
|
|
34
|
-
latest=$(curl -s https://api.github.com/repos/home-assistant/core/releases/latest | jq -r .tag_name)
|
|
35
|
-
latest_clean=${latest#v}
|
|
36
|
-
echo "ha_version=$latest_clean" >> $GITHUB_OUTPUT
|
|
37
|
-
|
|
38
|
-
- name: Update hacs.json
|
|
39
|
-
run: |
|
|
40
|
-
ha_version="${{ steps.ha-version.outputs.ha_version }}"
|
|
41
|
-
jq --arg ver "$ha_version" '.homeassistant = $ver' hacs.json > tmp.json && mv tmp.json hacs.json
|
|
42
|
-
|
|
43
|
-
- name: Commit updated hacs.json
|
|
44
|
-
run: |
|
|
45
|
-
git config user.name "github-actions[bot]"
|
|
46
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
47
|
-
git add hacs.json
|
|
48
|
-
if git commit -m "chore: update hacs.json with latest Home Assistant version [skip ci]"; then
|
|
49
|
-
git push origin master
|
|
50
|
-
else
|
|
51
|
-
echo "No changes to commit"
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Paso 4: Crear zip de la integración con nombre fijo meteocat.zip
|
|
55
|
-
- name: Zip integration
|
|
56
|
-
run: |
|
|
57
|
-
cd custom_components/meteocat
|
|
58
|
-
zip -r "$GITHUB_WORKSPACE/meteocat.zip" ./
|
|
59
|
-
echo "Zip created at $GITHUB_WORKSPACE/meteocat.zip"
|
|
60
|
-
|
|
61
|
-
# Paso 5: Subir meteocat.zip al release de GitHub
|
|
62
|
-
- name: Upload meteocat.zip to release
|
|
63
|
-
uses: softprops/action-gh-release@v2.2.1
|
|
64
|
-
with:
|
|
65
|
-
files: meteocat.zip
|
|
66
|
-
env:
|
|
67
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
1
|
+
name: Publish zip
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish-zip:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
# Paso 1: Checkout del repositorio completo
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
ref: master
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
|
|
22
|
+
# Paso 2: Obtener la versión del release recién publicado
|
|
23
|
+
- name: Get release version
|
|
24
|
+
id: release-version
|
|
25
|
+
run: |
|
|
26
|
+
version="${GITHUB_REF#refs/tags/v}"
|
|
27
|
+
echo "Release version: $version"
|
|
28
|
+
echo "version=$version" >> $GITHUB_OUTPUT
|
|
29
|
+
|
|
30
|
+
# Paso 3: Actualizar hacs.json con la última versión de Home Assistant
|
|
31
|
+
- name: Get latest Home Assistant version
|
|
32
|
+
id: ha-version
|
|
33
|
+
run: |
|
|
34
|
+
latest=$(curl -s https://api.github.com/repos/home-assistant/core/releases/latest | jq -r .tag_name)
|
|
35
|
+
latest_clean=${latest#v}
|
|
36
|
+
echo "ha_version=$latest_clean" >> $GITHUB_OUTPUT
|
|
37
|
+
|
|
38
|
+
- name: Update hacs.json
|
|
39
|
+
run: |
|
|
40
|
+
ha_version="${{ steps.ha-version.outputs.ha_version }}"
|
|
41
|
+
jq --arg ver "$ha_version" '.homeassistant = $ver' hacs.json > tmp.json && mv tmp.json hacs.json
|
|
42
|
+
|
|
43
|
+
- name: Commit updated hacs.json
|
|
44
|
+
run: |
|
|
45
|
+
git config user.name "github-actions[bot]"
|
|
46
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
47
|
+
git add hacs.json
|
|
48
|
+
if git commit -m "chore: update hacs.json with latest Home Assistant version [skip ci]"; then
|
|
49
|
+
git push origin master
|
|
50
|
+
else
|
|
51
|
+
echo "No changes to commit"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# Paso 4: Crear zip de la integración con nombre fijo meteocat.zip
|
|
55
|
+
- name: Zip integration
|
|
56
|
+
run: |
|
|
57
|
+
cd custom_components/meteocat
|
|
58
|
+
zip -r "$GITHUB_WORKSPACE/meteocat.zip" ./
|
|
59
|
+
echo "Zip created at $GITHUB_WORKSPACE/meteocat.zip"
|
|
60
|
+
|
|
61
|
+
# Paso 5: Subir meteocat.zip al release de GitHub
|
|
62
|
+
- name: Upload meteocat.zip to release
|
|
63
|
+
uses: softprops/action-gh-release@v2.2.1
|
|
64
|
+
with:
|
|
65
|
+
files: meteocat.zip
|
|
66
|
+
env:
|
|
67
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
name: Create Release
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
# Paso 1: Checkout completo (necesario para semantic-release y tags)
|
|
15
|
-
- name: Checkout repository
|
|
16
|
-
uses: actions/checkout@v3
|
|
17
|
-
with:
|
|
18
|
-
fetch-depth: 0
|
|
19
|
-
|
|
20
|
-
# Paso 2: Configurar Node.js
|
|
21
|
-
- name: Set up Node.js
|
|
22
|
-
uses: actions/setup-node@v3
|
|
23
|
-
with:
|
|
24
|
-
node-version: 20.8.1
|
|
25
|
-
|
|
26
|
-
# Paso 3: Instalar dependencias
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: npm ci
|
|
29
|
-
|
|
30
|
-
# Paso 4: Configurar el autor de Git
|
|
31
|
-
- name: Configure Git author
|
|
32
|
-
run: |
|
|
33
|
-
git config user.name "semantic-release-bot"
|
|
34
|
-
git config user.email "jdcuartero@yahoo.es"
|
|
35
|
-
|
|
36
|
-
# Paso 5: Ejecutar semantic-release (se encargará de actualizar versiones, changelog, y release)
|
|
37
|
-
- name: Run semantic-release
|
|
38
|
-
env:
|
|
39
|
-
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
|
|
40
|
-
NPM_TOKEN: ${{ secrets.NPM_WORKFLOW }}
|
|
41
|
-
run: npx semantic-release
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
name: Create Release
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
# Paso 1: Checkout completo (necesario para semantic-release y tags)
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
# Paso 2: Configurar Node.js
|
|
21
|
+
- name: Set up Node.js
|
|
22
|
+
uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: 20.8.1
|
|
25
|
+
|
|
26
|
+
# Paso 3: Instalar dependencias
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
# Paso 4: Configurar el autor de Git
|
|
31
|
+
- name: Configure Git author
|
|
32
|
+
run: |
|
|
33
|
+
git config user.name "semantic-release-bot"
|
|
34
|
+
git config user.email "jdcuartero@yahoo.es"
|
|
35
|
+
|
|
36
|
+
# Paso 5: Ejecutar semantic-release (se encargará de actualizar versiones, changelog, y release)
|
|
37
|
+
- name: Run semantic-release
|
|
38
|
+
env:
|
|
39
|
+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
|
|
40
|
+
NPM_TOKEN: ${{ secrets.NPM_WORKFLOW }}
|
|
41
|
+
run: npx semantic-release
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
name: Mark stale issues and pull requests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
schedule:
|
|
5
|
-
- cron: "30 1 * * *" # Ejecutar diariamente a la 01:30 UTC
|
|
6
|
-
workflow_dispatch: # Permite ejecución manual desde la interfaz
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
stale:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
issues: write
|
|
13
|
-
pull-requests: write
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
# 1. Issues/PRs generales sin actividad (excepto etiquetados)
|
|
17
|
-
- uses: actions/stale@v8
|
|
18
|
-
with:
|
|
19
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
days-before-stale: 60
|
|
21
|
-
days-before-close: 7
|
|
22
|
-
exempt-issue-labels: "help wanted,bug,feature"
|
|
23
|
-
exempt-pr-labels: "help wanted"
|
|
24
|
-
stale-issue-message: "This issue has had no activity for 60 days and will be closed in a week if there is no further activity."
|
|
25
|
-
stale-pr-message: "This pull request has had no activity for 60 days and will be closed in a week if there is no further activity."
|
|
26
|
-
stale-issue-label: "stale"
|
|
27
|
-
stale-pr-label: "stale"
|
|
28
|
-
|
|
29
|
-
# 2. Issues tipo "feature" sin actividad (solo etiquetar)
|
|
30
|
-
- uses: actions/stale@v8
|
|
31
|
-
with:
|
|
32
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
-
only-labels: "feature"
|
|
34
|
-
days-before-stale: 21
|
|
35
|
-
days-before-close: -1
|
|
36
|
-
stale-issue-message: >-
|
|
37
|
-
This feature request has had no activity for 3 weeks.
|
|
38
|
-
It has been marked as *help wanted* and will remain open.
|
|
39
|
-
stale-issue-label: "help wanted"
|
|
40
|
-
|
|
41
|
-
# 3. Issues tipo "bug" sin actividad (solo etiquetar)
|
|
42
|
-
- uses: actions/stale@v8
|
|
43
|
-
with:
|
|
44
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
-
only-labels: "bug"
|
|
46
|
-
days-before-stale: 21
|
|
47
|
-
days-before-close: -1
|
|
48
|
-
stale-issue-message: >-
|
|
49
|
-
This bug report has had no activity for 3 weeks.
|
|
50
|
-
It has been marked as *help wanted* and will remain open.
|
|
51
|
-
stale-issue-label: "help wanted"
|
|
52
|
-
|
|
53
|
-
# 4. Issues con "logs required" sin actividad (cerrar en 14 días)
|
|
54
|
-
- uses: actions/stale@v8
|
|
55
|
-
with:
|
|
56
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
57
|
-
only-labels: "logs required"
|
|
58
|
-
days-before-stale: 7
|
|
59
|
-
days-before-close: 1
|
|
60
|
-
stale-issue-message: >-
|
|
61
|
-
This issue has been marked as *requiring logs*, but no activity has been detected for 7 days.
|
|
62
|
-
Since logs were not provided, this issue will now be closed in 1 day.
|
|
63
|
-
stale-issue-label: "stale"
|
|
1
|
+
name: Mark stale issues and pull requests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "30 1 * * *" # Ejecutar diariamente a la 01:30 UTC
|
|
6
|
+
workflow_dispatch: # Permite ejecución manual desde la interfaz
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
stale:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
issues: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
# 1. Issues/PRs generales sin actividad (excepto etiquetados)
|
|
17
|
+
- uses: actions/stale@v8
|
|
18
|
+
with:
|
|
19
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
days-before-stale: 60
|
|
21
|
+
days-before-close: 7
|
|
22
|
+
exempt-issue-labels: "help wanted,bug,feature"
|
|
23
|
+
exempt-pr-labels: "help wanted"
|
|
24
|
+
stale-issue-message: "This issue has had no activity for 60 days and will be closed in a week if there is no further activity."
|
|
25
|
+
stale-pr-message: "This pull request has had no activity for 60 days and will be closed in a week if there is no further activity."
|
|
26
|
+
stale-issue-label: "stale"
|
|
27
|
+
stale-pr-label: "stale"
|
|
28
|
+
|
|
29
|
+
# 2. Issues tipo "feature" sin actividad (solo etiquetar)
|
|
30
|
+
- uses: actions/stale@v8
|
|
31
|
+
with:
|
|
32
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
+
only-labels: "feature"
|
|
34
|
+
days-before-stale: 21
|
|
35
|
+
days-before-close: -1
|
|
36
|
+
stale-issue-message: >-
|
|
37
|
+
This feature request has had no activity for 3 weeks.
|
|
38
|
+
It has been marked as *help wanted* and will remain open.
|
|
39
|
+
stale-issue-label: "help wanted"
|
|
40
|
+
|
|
41
|
+
# 3. Issues tipo "bug" sin actividad (solo etiquetar)
|
|
42
|
+
- uses: actions/stale@v8
|
|
43
|
+
with:
|
|
44
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
only-labels: "bug"
|
|
46
|
+
days-before-stale: 21
|
|
47
|
+
days-before-close: -1
|
|
48
|
+
stale-issue-message: >-
|
|
49
|
+
This bug report has had no activity for 3 weeks.
|
|
50
|
+
It has been marked as *help wanted* and will remain open.
|
|
51
|
+
stale-issue-label: "help wanted"
|
|
52
|
+
|
|
53
|
+
# 4. Issues con "logs required" sin actividad (cerrar en 14 días)
|
|
54
|
+
- uses: actions/stale@v8
|
|
55
|
+
with:
|
|
56
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
57
|
+
only-labels: "logs required"
|
|
58
|
+
days-before-stale: 7
|
|
59
|
+
days-before-close: 1
|
|
60
|
+
stale-issue-message: >-
|
|
61
|
+
This issue has been marked as *requiring logs*, but no activity has been detected for 7 days.
|
|
62
|
+
Since logs were not provided, this issue will now be closed in 1 day.
|
|
63
|
+
stale-issue-label: "stale"
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
name: Sync to GitLab
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published] # Se dispara al publicarse un release en GitHub
|
|
6
|
-
workflow_dispatch: # Permite ejecución manual desde la interfaz
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
sync:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
# Paso 1: Checkout completo
|
|
14
|
-
- name: Checkout repository
|
|
15
|
-
uses: actions/checkout@v3
|
|
16
|
-
with:
|
|
17
|
-
fetch-depth: 0
|
|
18
|
-
|
|
19
|
-
# Paso 2: Configurar Git
|
|
20
|
-
- name: Configure Git
|
|
21
|
-
run: |
|
|
22
|
-
git config user.name "github-bot"
|
|
23
|
-
git config user.email "bot@github.com"
|
|
24
|
-
|
|
25
|
-
# Paso 3: Añadir remoto de GitLab
|
|
26
|
-
- name: Add GitLab remote
|
|
27
|
-
env:
|
|
28
|
-
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
29
|
-
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
30
|
-
run: |
|
|
31
|
-
git remote add gitlab "https://oauth2:${GL_TOKEN}@${GL_REMOTE_URL#https://}"
|
|
32
|
-
|
|
33
|
-
# Paso 4: Comprobar divergencias en master
|
|
34
|
-
- name: Check for diverging commits
|
|
35
|
-
run: |
|
|
36
|
-
# Trae todas las ramas del remoto GitLab y crea referencias locales
|
|
37
|
-
git fetch gitlab +refs/heads/*:refs/remotes/gitlab/*
|
|
38
|
-
|
|
39
|
-
# Comprueba que la rama gitlab/master exista
|
|
40
|
-
if git show-ref --verify --quiet refs/remotes/gitlab/master; then
|
|
41
|
-
# Comprueba si GitLab master tiene commits que GitHub no tiene
|
|
42
|
-
if ! git merge-base --is-ancestor gitlab/master master; then
|
|
43
|
-
echo "❌ GitLab master tiene commits que GitHub no tiene. Revisar antes de sincronizar."
|
|
44
|
-
exit 1
|
|
45
|
-
else
|
|
46
|
-
echo "GitLab master está alineado con GitHub master ✅"
|
|
47
|
-
fi
|
|
48
|
-
else
|
|
49
|
-
echo "❌ La rama gitlab/master no se pudo encontrar localmente. Abortando."
|
|
50
|
-
exit 1
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# Paso 5: Push de commits y tags a GitLab
|
|
54
|
-
- name: Push commits and tags to GitLab
|
|
55
|
-
run: |
|
|
56
|
-
git push gitlab master
|
|
57
|
-
git push gitlab --tags
|
|
58
|
-
|
|
59
|
-
# Paso 6: Crear release en GitLab si no existe
|
|
60
|
-
- name: Create GitLab release
|
|
61
|
-
env:
|
|
62
|
-
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
63
|
-
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
64
|
-
RELEASE_TAG: ${{ github.ref_name }}
|
|
65
|
-
run: |
|
|
66
|
-
PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
|
|
67
|
-
PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
|
|
68
|
-
|
|
69
|
-
EXISTING=$(curl -s --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG")
|
|
70
|
-
|
|
71
|
-
if echo "$EXISTING" | grep -q 'tag_name'; then
|
|
72
|
-
echo "Release ya existe en GitLab: $RELEASE_TAG"
|
|
73
|
-
else
|
|
74
|
-
echo "Creando release en GitLab: $RELEASE_TAG"
|
|
75
|
-
curl -s --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases" \
|
|
76
|
-
--header "PRIVATE-TOKEN: $GL_TOKEN" \
|
|
77
|
-
--header "Content-Type: application/json" \
|
|
78
|
-
--data "{
|
|
79
|
-
\"name\": \"Release $RELEASE_TAG\",
|
|
80
|
-
\"tag_name\": \"$RELEASE_TAG\",
|
|
81
|
-
\"description\": \"Release sincronizado desde GitHub\"
|
|
82
|
-
}"
|
|
83
|
-
fi
|
|
84
|
-
|
|
85
|
-
# Paso 7: Subir meteocat.zip como asset al release de GitLab
|
|
86
|
-
- name: Upload meteocat.zip to GitLab release
|
|
87
|
-
env:
|
|
88
|
-
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
89
|
-
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
90
|
-
RELEASE_TAG: ${{ github.ref_name }}
|
|
91
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
92
|
-
run: |
|
|
93
|
-
PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
|
|
94
|
-
PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
|
|
95
|
-
|
|
96
|
-
ASSET_NAME="meteocat.zip"
|
|
97
|
-
ZIP_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/$RELEASE_TAG/meteocat.zip"
|
|
98
|
-
|
|
99
|
-
echo "Subiendo $ASSET_NAME al release de GitLab desde $ZIP_URL"
|
|
100
|
-
curl --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG/assets/links" \
|
|
101
|
-
--header "PRIVATE-TOKEN: $GL_TOKEN" \
|
|
102
|
-
--header "Content-Type: application/json" \
|
|
103
|
-
--data "{
|
|
104
|
-
\"name\": \"$ASSET_NAME\",
|
|
105
|
-
\"url\": \"$ZIP_URL\"
|
|
106
|
-
}"
|
|
107
|
-
|
|
1
|
+
name: Sync to GitLab
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published] # Se dispara al publicarse un release en GitHub
|
|
6
|
+
workflow_dispatch: # Permite ejecución manual desde la interfaz
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
sync:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
# Paso 1: Checkout completo
|
|
14
|
+
- name: Checkout repository
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
# Paso 2: Configurar Git
|
|
20
|
+
- name: Configure Git
|
|
21
|
+
run: |
|
|
22
|
+
git config user.name "github-bot"
|
|
23
|
+
git config user.email "bot@github.com"
|
|
24
|
+
|
|
25
|
+
# Paso 3: Añadir remoto de GitLab
|
|
26
|
+
- name: Add GitLab remote
|
|
27
|
+
env:
|
|
28
|
+
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
29
|
+
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
30
|
+
run: |
|
|
31
|
+
git remote add gitlab "https://oauth2:${GL_TOKEN}@${GL_REMOTE_URL#https://}"
|
|
32
|
+
|
|
33
|
+
# Paso 4: Comprobar divergencias en master
|
|
34
|
+
- name: Check for diverging commits
|
|
35
|
+
run: |
|
|
36
|
+
# Trae todas las ramas del remoto GitLab y crea referencias locales
|
|
37
|
+
git fetch gitlab +refs/heads/*:refs/remotes/gitlab/*
|
|
38
|
+
|
|
39
|
+
# Comprueba que la rama gitlab/master exista
|
|
40
|
+
if git show-ref --verify --quiet refs/remotes/gitlab/master; then
|
|
41
|
+
# Comprueba si GitLab master tiene commits que GitHub no tiene
|
|
42
|
+
if ! git merge-base --is-ancestor gitlab/master master; then
|
|
43
|
+
echo "❌ GitLab master tiene commits que GitHub no tiene. Revisar antes de sincronizar."
|
|
44
|
+
exit 1
|
|
45
|
+
else
|
|
46
|
+
echo "GitLab master está alineado con GitHub master ✅"
|
|
47
|
+
fi
|
|
48
|
+
else
|
|
49
|
+
echo "❌ La rama gitlab/master no se pudo encontrar localmente. Abortando."
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Paso 5: Push de commits y tags a GitLab
|
|
54
|
+
- name: Push commits and tags to GitLab
|
|
55
|
+
run: |
|
|
56
|
+
git push gitlab master
|
|
57
|
+
git push gitlab --tags
|
|
58
|
+
|
|
59
|
+
# Paso 6: Crear release en GitLab si no existe
|
|
60
|
+
- name: Create GitLab release
|
|
61
|
+
env:
|
|
62
|
+
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
63
|
+
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
64
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
65
|
+
run: |
|
|
66
|
+
PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
|
|
67
|
+
PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
|
|
68
|
+
|
|
69
|
+
EXISTING=$(curl -s --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG")
|
|
70
|
+
|
|
71
|
+
if echo "$EXISTING" | grep -q 'tag_name'; then
|
|
72
|
+
echo "Release ya existe en GitLab: $RELEASE_TAG"
|
|
73
|
+
else
|
|
74
|
+
echo "Creando release en GitLab: $RELEASE_TAG"
|
|
75
|
+
curl -s --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases" \
|
|
76
|
+
--header "PRIVATE-TOKEN: $GL_TOKEN" \
|
|
77
|
+
--header "Content-Type: application/json" \
|
|
78
|
+
--data "{
|
|
79
|
+
\"name\": \"Release $RELEASE_TAG\",
|
|
80
|
+
\"tag_name\": \"$RELEASE_TAG\",
|
|
81
|
+
\"description\": \"Release sincronizado desde GitHub\"
|
|
82
|
+
}"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# Paso 7: Subir meteocat.zip como asset al release de GitLab
|
|
86
|
+
- name: Upload meteocat.zip to GitLab release
|
|
87
|
+
env:
|
|
88
|
+
GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
|
|
89
|
+
GL_TOKEN: ${{ secrets.GL_TOKEN }}
|
|
90
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
91
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
92
|
+
run: |
|
|
93
|
+
PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
|
|
94
|
+
PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
|
|
95
|
+
|
|
96
|
+
ASSET_NAME="meteocat.zip"
|
|
97
|
+
ZIP_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/$RELEASE_TAG/meteocat.zip"
|
|
98
|
+
|
|
99
|
+
echo "Subiendo $ASSET_NAME al release de GitLab desde $ZIP_URL"
|
|
100
|
+
curl --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG/assets/links" \
|
|
101
|
+
--header "PRIVATE-TOKEN: $GL_TOKEN" \
|
|
102
|
+
--header "Content-Type: application/json" \
|
|
103
|
+
--data "{
|
|
104
|
+
\"name\": \"$ASSET_NAME\",
|
|
105
|
+
\"url\": \"$ZIP_URL\"
|
|
106
|
+
}"
|
|
107
|
+
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
name: Sync labels
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
paths:
|
|
6
|
-
- .github/labels.yml
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
labels:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v4
|
|
14
|
-
|
|
15
|
-
- name: Sync GitHub labels (safe)
|
|
16
|
-
uses: crazy-max/ghaction-github-labeler@v5
|
|
17
|
-
with:
|
|
18
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
-
yaml-file: .github/labels.yml
|
|
20
|
-
skip-delete: true # no elimina labels que no estén en el YAML
|
|
21
|
-
dry-run: false # aplica cambios realmente
|
|
1
|
+
name: Sync labels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- .github/labels.yml
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
labels:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Sync GitHub labels (safe)
|
|
16
|
+
uses: crazy-max/ghaction-github-labeler@v5
|
|
17
|
+
with:
|
|
18
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
yaml-file: .github/labels.yml
|
|
20
|
+
skip-delete: true # no elimina labels que no estén en el YAML
|
|
21
|
+
dry-run: false # aplica cambios realmente
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
name: Validate
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
pull_request:
|
|
6
|
-
schedule:
|
|
7
|
-
- cron: "0 0 * * *"
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
validate-hacs:
|
|
12
|
-
runs-on: "ubuntu-latest"
|
|
13
|
-
steps:
|
|
14
|
-
- name: HACS validation
|
|
15
|
-
uses: "hacs/action@main"
|
|
16
|
-
with:
|
|
1
|
+
name: Validate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "0 0 * * *"
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
validate-hacs:
|
|
12
|
+
runs-on: "ubuntu-latest"
|
|
13
|
+
steps:
|
|
14
|
+
- name: HACS validation
|
|
15
|
+
uses: "hacs/action@main"
|
|
16
|
+
with:
|
|
17
17
|
category: "integration"
|