diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 7d562af..9774f82 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ name-template: 'Release $RESOLVED_VERSION' -tag-template: 'v$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..346db80 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,92 @@ +name: Publish + +on: + release: + types: + - published + +jobs: + update-versions-changelog: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + with: + ref: main + - name: Strip prefix from tag and return version + id: version + run: | + TAG=${{ github.event.release.tag_name }} + echo "version=${TAG}" >> "$GITHUB_OUTPUT" + - name: Echo version + run: | + echo ${{ steps.version.outputs.version }} + # - name: Update root package.json version + # uses: jossef/action-set-json-field@v2.1 + # with: + # file: package.json + # field: version + # value: ${{ steps.version.outputs.version }} + # - name: Update laskakit-data-feeder package.json version + # uses: jossef/action-set-json-field@v2.1 + # with: + # file: laskakit-data-feeder/package.json + # field: version + # value: ${{ steps.version.outputs.version }} + # - name: Update laskakit-data-feeder addon config.json version + # uses: jossef/action-set-json-field@v2.1 + # with: + # file: laskakit-data-feeder/config.json + # field: version + # value: ${{ steps.version.outputs.version }} + - name: Extract release date from git tag + id: release_date + run: | + echo "date=$(git log -1 --date=short --format=%ad '${{ github.event.release.tag_name }}')" >> $GITHUB_OUTPUT; + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ steps.version.outputs.version }} + release-date: ${{ steps.release_date.outputs.date }} + release-notes: ${{ github.event.release.body }} + - name: Commit and push + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "chore: Release ${{ steps.version.outputs.version }} [skip ci]" + + # publish-docker: + # name: Publish to Docker Hub + # runs-on: ubuntu-latest + # needs: + # - update-versions-changelog + # steps: + # - uses: actions/checkout@v3 + # with: + # ref: main + # - name: Login to DockerHub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Publish to Docker Hub + # uses: home-assistant/builder@master + # with: + # args: | + # --all \ + # --target laskakit-data-feeder \ + # --docker-hub ${{ secrets.DOCKERHUB_USERNAME }} + + # update-add-ons-repository: + # name: 📢 Publish Add-on in Homeassistant + # runs-on: ubuntu-latest + # needs: + # - publish-docker + # steps: + # - name: 🚀 Dispatch Repository Updater update signal + # uses: peter-evans/repository-dispatch@v1 + # with: + # token: ${{ secrets.HA_DISPATCH_TOKEN }} + # repository: radoslavirha/homeassistant-addons + # event-type: update + # client-payload: '{"addon": "laskakit-data-feeder"}'