Skip to content

Commit

Permalink
build: create release for both cards
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Dec 10, 2024
1 parent babaaf3 commit c6a59b4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 35 deletions.
48 changes: 34 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,45 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{steps.build_changelog.outputs.changelog}}
prerelease: true

# Build
- name: Build the file
run: |
cd /home/runner/work/custom-sonos-card/custom-sonos-card
npm install
npm run build
alias gsed=sed
sh create-dist-maxi-media-player.sh
- name: Upload to release
uses: svenstaro/upload-release-action@v2
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{steps.build_changelog.outputs.changelog}}
prerelease: true
files: /home/runner/work/custom-sonos-card/custom-sonos-card/dist/custom-sonos-card.js

- name: Create Release
uses: softprops/action-gh-release@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/custom-sonos-card/custom-sonos-card/dist/custom-sonos-card.js
asset_name: custom-sonos-card.js
tag: ${{ github.ref }}
overwrite: true
body: ${{steps.build_changelog.outputs.changelog}}
repository: punxaphil/maxi-media-player
prerelease: true
token: ${{ secrets.PAT_TOKEN }}
files: /home/runner/work/custom-sonos-card/custom-sonos-card/dist-maxi-media-player/maxi-media-player.js

- uses: actions/checkout@v4
with:
repository: punxaphil/maxi-media-player
token: ${{ secrets.PAT_TOKEN }}
path: mxmp
- name: setup git config
run: |
cd mxmp
cp ../dist-maxi-media-player/README.md .
diff=$(git diff)
if [ ! -z $diff ]
then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am"updated README.md"
git push origin main
fi
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.idea
dist/
dist*/
.DS_Store
node_modules/
coverage/
lcov-report/
lcov-report/
19 changes: 0 additions & 19 deletions copy-to-maxi-media-player.sh

This file was deleted.

24 changes: 24 additions & 0 deletions create-dist-maxi-media-player.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
DIR="dist-maxi-media-player"
FILE="maxi-media-player.js"
mkdir -p $DIR

cp dist/custom-sonos-card.js $DIR/$FILE
cd $DIR || exit
gsed -i 's/"sonos-card"/"maxi-media-player"/g' $FILE
gsed -i 's/"Sonos"/"Maxi Media Player"/g' $FILE
gsed -i 's/sonos-card-/mxmp-/g' $FILE
gsed -i 's/sonos-/mxmp-/g' $FILE
gsed -i 's/sonos-card-dispatch/mxmp-dispatch/g' $FILE
gsed -i 's/Sonos Card/Maxi Media Player/g' $FILE
gsed -i 's/Media player for your Sonos speakers/Media card for Home Assistant UI with a focus on managing multiple media players/g' $FILE

FILE="README.md"
cd ..
cp $FILE $DIR/
cd $DIR || exit
gsed -i '/\/\/#ONLY_SONOS_CARD_START/,/\/\/#ONLY_SONOS_CARD_END/d' $FILE
gsed -i ':a;N;$!ba;s/[^\n]*#ONLY_SONOS_CARD[^\n]*\n//g' $FILE
gsed -i 's/custom-sonos-card/maxi-media-player/g' $FILE
gsed -i 's/custom:sonos-card/custom:maxi-media-player/g' $FILE
gsed -i 's/Sonos Card/Maxi Media Player/g' $FILE

0 comments on commit c6a59b4

Please sign in to comment.