init
This commit is contained in:
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