mirror of
https://github.com/Mesteriis/hassio-addons-avm.git
synced 2026-01-09 23:11:02 +01:00
init
This commit is contained in:
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.github/* @frenck
|
||||
133
.github/CODE_OF_CONDUCT.md
vendored
Normal file
133
.github/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
frenck@frenck.dev.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][faq]. Translations are available
|
||||
at [https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||
[mozilla coc]: https://github.com/mozilla/diversity
|
||||
[faq]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
29
.github/CONTRIBUTING.md
vendored
Normal file
29
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish
|
||||
to make via issue, email, or any other method with the owners of this repository
|
||||
before making a change.
|
||||
|
||||
Please note we have a code of conduct, please follow it in all your interactions
|
||||
with the project.
|
||||
|
||||
## Issues and feature requests
|
||||
|
||||
You've found a bug in the source code, a mistake in the documentation or maybe
|
||||
you'd like a new feature? You can help us by submitting an issue to our
|
||||
[GitHub Repository][github]. Before you create an issue, make sure you search
|
||||
the archive, maybe your question was already answered.
|
||||
|
||||
Even better: You could submit a pull request with a fix / new feature!
|
||||
|
||||
## Pull request process
|
||||
|
||||
1. Search our repository for open or closed [pull requests][prs] that relates
|
||||
to your submission. You don't want to duplicate effort.
|
||||
|
||||
1. You may merge the pull request in once you have the sign-off of two other
|
||||
developers, or if you do not have permission to do that, you may request
|
||||
the second reviewer to merge it for you.
|
||||
|
||||
[github]: https://github.com/hassio-addons/repository/issues
|
||||
[prs]: https://github.com/hassio-addons/repository/pulls
|
||||
20
.github/ISSUE_TEMPLATE.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Problem/Motivation
|
||||
|
||||
> (Why the issue was filed)
|
||||
|
||||
## Expected behavior
|
||||
|
||||
> (What you expected to happen)
|
||||
|
||||
## Actual behavior
|
||||
|
||||
> (What actually happened)
|
||||
|
||||
## Steps to reproduce
|
||||
|
||||
> (How can someone else make/see it happen)
|
||||
|
||||
## Proposed changes
|
||||
|
||||
> (If you have a proposed change, workaround or fix,
|
||||
> describe the rationale behind it)
|
||||
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Proposed Changes
|
||||
|
||||
> (Describe the changes and rationale behind them)
|
||||
|
||||
## Related Issues
|
||||
|
||||
> ([Github link][autolink-references] to related issues or pull requests)
|
||||
|
||||
[autolink-references]: https://help.github.com/articles/autolinked-references-and-urls/
|
||||
1839
.github/SECURITY.md
vendored
Normal file
1839
.github/SECURITY.md
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
.github/dependabot.yaml
vendored
Normal file
13
.github/dependabot.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "06:00"
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "06:00"
|
||||
85
.github/labels.yml
vendored
Normal file
85
.github/labels.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
- name: "breaking-change"
|
||||
color: ee0701
|
||||
description: "A breaking change for existing users."
|
||||
- name: "bugfix"
|
||||
color: ee0701
|
||||
description: "Inconsistencies or issues which will cause a problem for users or implementors."
|
||||
- name: "documentation"
|
||||
color: 0052cc
|
||||
description: "Solely about the documentation of the project."
|
||||
- name: "enhancement"
|
||||
color: 1d76db
|
||||
description: "Enhancement of the code, not introducing new features."
|
||||
- name: "refactor"
|
||||
color: 1d76db
|
||||
description: "Improvement of existing code, not introducing new features."
|
||||
- name: "performance"
|
||||
color: 1d76db
|
||||
description: "Improving performance, not introducing new features."
|
||||
- name: "new-feature"
|
||||
color: 0e8a16
|
||||
description: "New features or options."
|
||||
- name: "maintenance"
|
||||
color: 2af79e
|
||||
description: "Generic maintenance tasks."
|
||||
- name: "ci"
|
||||
color: 1d76db
|
||||
description: "Work that improves the continue integration."
|
||||
- name: "dependencies"
|
||||
color: 1d76db
|
||||
description: "Upgrade or downgrade of project dependencies."
|
||||
|
||||
- name: "in-progress"
|
||||
color: fbca04
|
||||
description: "Issue is currently being resolved by a developer."
|
||||
- name: "stale"
|
||||
color: fef2c0
|
||||
description: "There has not been activity on this issue or PR for quite some time."
|
||||
- name: "no-stale"
|
||||
color: fef2c0
|
||||
description: "This issue or PR is exempted from the stable bot."
|
||||
|
||||
- name: "security"
|
||||
color: ee0701
|
||||
description: "Marks a security issue that needs to be resolved asap."
|
||||
- name: "incomplete"
|
||||
color: fef2c0
|
||||
description: "Marks a PR or issue that is missing information."
|
||||
- name: "invalid"
|
||||
color: fef2c0
|
||||
description: "Marks a PR or issue that is missing information."
|
||||
|
||||
- name: "beginner-friendly"
|
||||
color: 0e8a16
|
||||
description: "Good first issue for people wanting to contribute to the project."
|
||||
- name: "help-wanted"
|
||||
color: 0e8a16
|
||||
description: "We need some extra helping hands or expertise in order to resolve this."
|
||||
|
||||
- name: "hacktoberfest"
|
||||
description: "Issues/PRs are participating in the Hacktoberfest."
|
||||
color: fbca04
|
||||
- name: "hacktoberfest-accepted"
|
||||
description: "Issues/PRs are participating in the Hacktoberfest."
|
||||
color: fbca04
|
||||
|
||||
- name: "priority-critical"
|
||||
color: ee0701
|
||||
description: "This should be dealt with ASAP. Not fixing this issue would be a serious error."
|
||||
- name: "priority-high"
|
||||
color: b60205
|
||||
description: "After critical issues are fixed, these should be dealt with before any further issues."
|
||||
- name: "priority-medium"
|
||||
color: 0e8a16
|
||||
description: "This issue may be useful, and needs some attention."
|
||||
- name: "priority-low"
|
||||
color: e4ea8a
|
||||
description: "Nice addition, maybe... someday..."
|
||||
|
||||
- name: "major"
|
||||
color: b60205
|
||||
description: "This PR causes a major version bump in the version number."
|
||||
- name: "minor"
|
||||
color: 0e8a16
|
||||
description: "This PR causes a minor version bump in the version number."
|
||||
22
.github/workflows/labels.yaml
vendored
Normal file
22
.github/workflows/labels.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Sync labels
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- .github/labels.yml
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
name: ♻️ Sync labels
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: 🚀 Run Label Syncer
|
||||
uses: micnncim/action-label-syncer@v1.3.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
33
.github/workflows/lint.yaml
vendored
Normal file
33
.github/workflows/lint.yaml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: Lint
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
json:
|
||||
name: JSON Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: 🚀 Run JQ
|
||||
run: |
|
||||
shopt -s globstar
|
||||
cat **/*.json | jq '.'
|
||||
|
||||
yamllint:
|
||||
name: YAMLLint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: 🚀 Run YAMLLint
|
||||
uses: frenck/action-yamllint@v1.1
|
||||
21
.github/workflows/lock.yaml
vendored
Normal file
21
.github/workflows/lock.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Lock
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 9 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
name: 🔒 Lock closed issues and PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2.0.3
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: "30"
|
||||
issue-lock-reason: ""
|
||||
pr-lock-inactive-days: "1"
|
||||
pr-lock-reason: ""
|
||||
54
.github/workflows/repository-updater.yaml
vendored
Normal file
54
.github/workflows/repository-updater.yaml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: Repository Updater
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: ["update"]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish add-on update
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🚀 Run Repository Updater
|
||||
uses: hassio-addons/repository-updater@v1.1
|
||||
with:
|
||||
addon: ${{ github.event.client_payload.addon }}
|
||||
repository: ${{ github.repository }}
|
||||
token: ${{ secrets.UPDATER_TOKEN }}
|
||||
|
||||
announce:
|
||||
name: Announce add-on update
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 📢 Announce on Discord server
|
||||
uses: sarisia/actions-status-discord@v1.8.6
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
username: ${{ github.event.client_payload.name }}
|
||||
avatar_url: |
|
||||
https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.client_payload.addon }}/icon.png
|
||||
title: ":arrow_up: ${{ github.event.client_payload.name }} ${{ github.event.client_payload.version }}"
|
||||
image: |
|
||||
https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.client_payload.addon }}/logo.png
|
||||
description: |
|
||||
A new version of the ${{ github.event.client_payload.name }} add-on has been published.
|
||||
|
||||
**Version**: `${{ github.event.client_payload.version }}`
|
||||
**Release notes**:
|
||||
<https://github.com/${{ github.event.client_payload.repository }}/releases/tag/${{ github.event.client_payload.version }}>
|
||||
|
||||
- name: 📢 Announce on Twitter
|
||||
uses: devigned/go-twitter-action@v1.0.2
|
||||
with:
|
||||
apiKey: ${{ secrets.TWITTER_API_KEY }}
|
||||
apiKeySecret: ${{ secrets.TWITTER_API_SECRET }}
|
||||
accessToken: ${{ secrets.TWITTER_ACCESS_TOKEN }}
|
||||
accessTokenSecret: ${{ secrets.TWITTER_ACCESS_SECRET }}
|
||||
message: |
|
||||
⬆️ ${{ github.event.client_payload.name }} ${{ github.event.client_payload.version }}
|
||||
|
||||
https://github.com/${{ github.event.client_payload.repository }}/releases/tag/${{ github.event.client_payload.version }}
|
||||
40
.github/workflows/stale.yaml
vendored
Normal file
40
.github/workflows/stale.yaml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Stale
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 8 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
name: 🧹 Clean up stale issues and PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🚀 Run stale
|
||||
uses: actions/stale@v3.0.19
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 30
|
||||
days-before-close: 7
|
||||
remove-stale-when-updated: true
|
||||
stale-issue-label: "stale"
|
||||
exempt-issue-labels: "no-stale,help-wanted"
|
||||
stale-issue-message: >
|
||||
There hasn't been any activity on this issue recently, so we
|
||||
clean up some of the older and inactive issues.
|
||||
|
||||
Please make sure to update to the latest version and
|
||||
check if that solves the issue. Let us know if that works for you
|
||||
by leaving a comment 👍
|
||||
|
||||
This issue has now been marked as stale and will be closed if no
|
||||
further activity occurs. Thanks!
|
||||
stale-pr-label: "stale"
|
||||
exempt-pr-labels: "no-stale"
|
||||
stale-pr-message: >
|
||||
There hasn't been any activity on this pull request recently. This
|
||||
pull request has been automatically marked as stale because of that
|
||||
and will be closed if no further activity occurs within 7 days.
|
||||
Thank you for your contributions.
|
||||
75
.github/workflows/translations-download.yaml
vendored
Normal file
75
.github/workflows/translations-download.yaml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
name: Translations Download
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 8 * * *"
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Translations Upload"]
|
||||
branches: [master]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
json:
|
||||
name: Download Translations
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: 🏗 Set up yq
|
||||
uses: frenck/action-setup-yq@v1.0.0
|
||||
- name: 🏗 Set up the Lokalise CLI
|
||||
uses: frenck/action-setup-lokalise@v1.0.0
|
||||
- name: ⤵️ Download translations
|
||||
run: |
|
||||
echo "Downloading translations to lokalise"
|
||||
lokalise2 file download \
|
||||
--token "${LOKALISE_TOKEN}" \
|
||||
--project-id "${LOKALISE_PROJECT}" \
|
||||
--format yaml \
|
||||
--original-filenames=false \
|
||||
--export-empty-as base \
|
||||
--bundle-structure ".translations/%LANG_ISO%.yaml"
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}
|
||||
- name: 🚀 Process translations
|
||||
run: |
|
||||
addons=$(yq e '.addons | keys | .[]' .addons.yml)
|
||||
mkdir -p .translations
|
||||
for file in .translations/*.yaml;
|
||||
do
|
||||
filename=$(basename "${file}")
|
||||
language="${filename%.*}"
|
||||
if [[ "${language}" == "en" ]]; then
|
||||
continue
|
||||
fi
|
||||
echo "Processing downloaded translations in ${language}..."
|
||||
while read addon;
|
||||
do
|
||||
if [[ -f "${addon}/translations/en.yaml" ]];
|
||||
then
|
||||
echo "Processing downloaded translations in ${language} for ${addon}..."
|
||||
yq e ".${addon}" "${file}" \
|
||||
> "${addon}/translations/${filename}"
|
||||
fi
|
||||
done <<<"${addons}"
|
||||
done
|
||||
- name: 🚀 Commit changes
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "${GITHUB_ACTOR}"
|
||||
git add .
|
||||
git commit -m "🌍 Updating translations" -a
|
||||
- name: 🚀 Push changes
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref }}
|
||||
53
.github/workflows/translations-upload.yaml
vendored
Normal file
53
.github/workflows/translations-upload.yaml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: Translations Upload
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Repository Updater"]
|
||||
branches: [master]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload Translations
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: 🏗 Set up yq
|
||||
uses: frenck/action-setup-yq@v1.0.0
|
||||
- name: 🏗 Set up the Lokalise CLI
|
||||
uses: frenck/action-setup-lokalise@v1.0.0
|
||||
- name: 🚀 Combine translations
|
||||
run: |
|
||||
addons=$(yq e '.addons | keys | .[]' .addons.yml)
|
||||
mkdir -p .translations
|
||||
while read addon;
|
||||
do
|
||||
if [[ -f "${addon}/translations/en.yaml" ]];
|
||||
then
|
||||
echo "Prepping translation upload for $addon..."
|
||||
ADDON="${addon}" \
|
||||
yq e '{env(ADDON): .}' "${addon}/translations/en.yaml" \
|
||||
> ".translations/${addon}.yaml"
|
||||
fi
|
||||
done <<<"${addons}"
|
||||
|
||||
echo "Combining translation files..."
|
||||
yq ea '. as $item ireduce ({}; . * $item)' ./.translations/*.yaml > translations.yaml
|
||||
- name: 🚀 Upload translations
|
||||
run: |
|
||||
echo "Uploading translations to lokalise"
|
||||
lokalise2 file upload \
|
||||
--apply-tm \
|
||||
--lang-iso en \
|
||||
--poll \
|
||||
--token "${LOKALISE_TOKEN}" \
|
||||
--project-id "${LOKALISE_PROJECT}" \
|
||||
--file translations.yaml
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}
|
||||
Reference in New Issue
Block a user