Updated Paths for Service.d Scripts #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and deploy | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: shellcheck | |
run: shellcheck telegraf/run.sh | |
- name: Get current Version | |
id: version | |
run: | | |
if [[ "${{ github.ref_type }}" = "tag" ]]; then | |
echo "version=$(echo ${{ github.ref }} | sed "s/^.*\/v//g")" >> $GITHUB_OUTPUT | |
else | |
echo "Ref Type not tag: ${{github.ref_type}}" | |
echo "latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Update Version in build.yml | |
env: | |
VERSION: ${{ steps.version.outputs.version }} | |
run: | | |
sed -i "s/io.hass.version:.*/io.hass.version: ${VERSION}/g" telegraf/build.yml | |
sed -i "s/version:.*/version: ${VERSION}/g" telegraf/config.yml | |
- name: check build.yml and config.yml | |
run: | | |
cat telegraf/build.yml | grep "io.hass.version" | |
cat telegraf/config.yml | grep "version" | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build docker files | |
uses: home-assistant/[email protected] | |
with: | |
args: | | |
--all \ | |
--target telegraf \ | |
--docker-hub ghcr.io/${{ github.repository_owner }} | |
push-config-to-addon-repo: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Main Repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
path: main | |
- name: Update Version in config.yml | |
env: | |
VERSION: ${{ needs.build.outputs.version }} | |
run: | | |
sed -i "s/version:.*/version: ${VERSION}/g" main/telegraf/config.yml | |
- name: Checkout Addon Repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
path: addon | |
repository: jnull/hassio-addons | |
- name: setup local env | |
env: | |
VERSION: ${{ needs.build.outputs.version }} | |
run: | | |
\cp -Rv main/telegraf/config.yml addon/telegraf/config.yml | |
\cp -Rv main/README.md addon/telegraf/README.md | |
cd addon | |
git config --local user.email "[email protected]" | |
git config --local user.name "jnull" | |
git add . | |
git commit -m "Add changes for version: ${VERSION}" | |
continue-on-error: true | |
- name: copy config to repo dir in case of change | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.REGISTRY_CREDS }} | |
repository: jnull/hassio-addons | |
directory: addon |