-
-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (76 loc) · 2.95 KB
/
releaser.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
on:
workflow_dispatch:
inputs:
semverIncrement:
description: Increment major/minor/patch using values of m/i/p
required: true
default: i
name: Releaser
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.semver.outputs.semver }}
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ghostfolio
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest release
run: |
echo "latest_release=$(curl --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --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 }}/ghostfolio
- name: Create release
uses: softprops/[email protected]
with:
tag_name: v${{ steps.semver.outputs.semver }}
generate_release_notes: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout addon repo
uses: actions/[email protected]
with:
path: repo
repository: lildude/ha-addons
token: ${{ secrets.HA_ADDONS_PAT }}
- name: Update addon repo
run: |
cp -vf ${{ github.workspace }}/ghostfolio/*.png ${{ github.workspace }}/repo/ghostfolio
cp -vf ${{ github.workspace }}/ghostfolio/*.md ${{ github.workspace }}/repo/ghostfolio
jq '.version="${{ steps.semver.outputs.semver }}"' < ${{ github.workspace }}/ghostfolio/config.json > ${{ github.workspace }}/repo/ghostfolio/config.json
echo "$(curl --silent --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r .body)" > ${{ github.workspace }}/repo/ghostfolio/CHANGELOG.md
- name: Add changes to addon repo
run: |
if [ "$(git status -s)" ]; then
git add .
git commit -m 'Update ha-addon-ghostfolio to v${{ steps.semver.outputs.semver }}'
git push
fi
working-directory: ${{ github.workspace }}/repo/ghostfolio
build:
name: Build addon
needs: release
permissions:
contents: read
packages: write
uses: ./.github/workflows/publisher.yaml
with:
version: ${{ needs.release.outputs.version }}