This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
66 lines (63 loc) · 2.39 KB
/
release.yml
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
on:
workflow_dispatch:
inputs:
semverIncrement:
description: Increment major/minor/patch using values of m/i/p
required: true
default: i
name: Create release
jobs:
build:
name: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout Teslamate
uses: actions/checkout@v4
with:
path: teslamate
- name: Get latest release
run: |
echo "latest_release=$(curl --silent https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r .tag_name | sed s/v// )" >> $GITHUB_ENV
- name: Increment semver
id: semver
uses: matt-FFFFFF/[email protected]
with:
semver-input: ${{ env.latest_release }}
increment: ${{ github.event.inputs.semverIncrement }}
- name: Create tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git tag -a v${{ steps.semver.outputs.semver }} -m 'Release automation'
git push --tags
working-directory: ${{ github.workspace }}/teslamate
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.REPO_PAT }}
with:
tag_name: v${{ steps.semver.outputs.semver }}
release_name: Release v${{ steps.semver.outputs.semver }}
body_path: ${{ github.workspace }}/teslamate/CHANGELOG.md
draft: false
prerelease: false
- name: Checkout repository
uses: actions/checkout@v4
with:
path: repo
repository: matt-FFFFFF/hassio-addon-repository
token: ${{ secrets.REPO_PAT }}
- name: Update addon repo
run: |
cp -vf ${{ github.workspace }}/teslamate/*.png ${{ github.workspace }}/repo/teslamate
cp -vf ${{ github.workspace }}/teslamate/*.md ${{ github.workspace }}/repo/teslamate
jq '.version="${{ steps.semver.outputs.semver }}"' < ${{ github.workspace }}/teslamate/config.json > ${{ github.workspace }}/repo/teslamate/config.json
- name: Add changes to addon repo
run: |
if [ "$(git status -s)" ]; then
git add .
git commit -m 'Update from hassio-addon-teslamate'
git push
fi
working-directory: ${{ github.workspace }}/repo/teslamate