Skip to content

Commit

Permalink
Call publisher directly (#12)
Browse files Browse the repository at this point in the history
Seems the release publish doesn't always trigger when the release is created via a workflow, so lets skip it
  • Loading branch information
lildude authored Apr 21, 2024
1 parent 6e20290 commit c3ba3a8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/publisher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
release:
types: [published]
workflow_dispatch:
workflow_call:
inputs:
version:
required: false
type: string

jobs:
publish:
Expand All @@ -20,17 +25,27 @@ jobs:
- name: Checkout the repository
uses: actions/[email protected]

- name: Get version
run: |
version=${{ inputs.version }}
if [ -n "$version" ]; then
echo "latest_release=$version" >> $GITHUB_ENV
else
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
fi
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish
- name: Build and publish
uses: home-assistant/builder@master
with:
args: |
--${{ matrix.arch }} \
--version ${{ env.latest_release }} \
--target /data/ \
--addon
16 changes: 15 additions & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ on:
name: Releaser

jobs:
build:
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
Expand Down Expand Up @@ -50,6 +53,7 @@ jobs:
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
Expand All @@ -64,3 +68,13 @@ jobs:
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 }}

0 comments on commit c3ba3a8

Please sign in to comment.