Skip to content

Spotube Publish Binary #34

Spotube Publish Binary

Spotube Publish Binary #34

name: Spotube Publish Binary
on:
workflow_dispatch:
inputs:
version:
description: Version to publish (x.x.x)
default: 3.8.0
required: true
dry_run:
description: Dry run
required: true
type: boolean
default: true
jobs:
description: Jobs to run (flathub,aur,winget,chocolatey,playstore)
required: true
type: string
default: "flathub,aur,winget,chocolatey,playstore"
jobs:
flathub:
runs-on: ubuntu-22.04
if: contains(inputs.jobs, 'flathub')
steps:
- uses: actions/checkout@v4
with:
repository: KRTirtho/com.github.KRTirtho.Spotube
token: ${{ secrets.FLATHUB_TOKEN }}
- uses: actions/checkout@v4
with:
path: spotube
- name: Update flathub version
run: |
python3 spotube/scripts/update_flathub_version.py ${{ inputs.version }}
rm -rf spotube
git config --global user.email "krtirtho@gmail.com"
git config --global user.name "Kingkor Roy Tirtho"
git add .
git commit -m "v${{ inputs.version }} Update"
git branch update-${{ inputs.version }}
git switch update-${{ inputs.version }}
- name: Push to flathub
if: ${{ !inputs.dry_run }}
run: git push -u origin update-${{ inputs.version }}
aur:
runs-on: ubuntu-22.04
if: contains(inputs.jobs, 'aur')
steps:
- uses: actions/checkout@v4
- uses: dsaltares/fetch-gh-release-asset@master
with:
version: tags/v${{ inputs.version }} # mind the "v" prefix
file: spotube-linux-${{inputs.version}}-x86_64.tar.xz
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update PKGBUILD versions
run: |
sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" aur-struct/PKGBUILD
sed -i "s/%{{PKGREL}}%/1/" aur-struct/PKGBUILD
sed -i "s/%{{LINUX_MD5}}%/`md5sum spotube-linux-${{inputs.version}}-x86_64.tar.xz | awk '{print $1}'`/" aur-struct/PKGBUILD
- name: Release to AUR
if: ${{ !inputs.dry_run }}
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
with:
pkgname: spotube-bin
pkgbuild: aur-struct/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Updated to v${{ inputs.version }}
winget:
runs-on: windows-latest
if: contains(inputs.jobs, 'winget')
steps:
- name: Release winget package
if: ${{ !inputs.dry_run }}
uses: vedantmgoyal2009/winget-releaser@v2
with:
version: ${{ inputs.version }}
release-tag: v${{ inputs.version }}
identifier: KRTirtho.Spotube
token: ${{ secrets.WINGET_TOKEN }}
chocolatey:
runs-on: windows-latest
if: contains(inputs.jobs, 'chocolatey')
steps:
- uses: dsaltares/fetch-gh-release-asset@master
with:
version: tags/v${{ inputs.version }} # mind the "v" prefix
file: Spotube-windows-x86_64.nupkg
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Chocolatey
run: choco apikey -k ${{ secrets.CHOCO_API_KEY }} --source https://push.chocolatey.org/
- name: Publish to Chocolatey Repository
if: ${{ !inputs.dry_run }}
run: choco push Spotube-windows-x86_64.nupkg --source https://push.chocolatey.org/
playstore:
runs-on: ubuntu-latest
if: contains(inputs.jobs, 'playstore')
steps:
- name: Tagname (workflow dispatch)
run: echo 'TAG_NAME=${{inputs.version}}' >> $GITHUB_ENV
- uses: robinraju/release-downloader@main
with:
repository: KRTirtho/spotube
tag: v${{ env.TAG_NAME }}
tarBall: false
zipBall: false
out-file-path: dist
fileName: "Spotube-playstore-all-arch.aab"
- name: Create service-account.json
run: |
echo "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > service-account.json
- name: Upload Android Release to Play Store
if: ${{!inputs.dry_run}}
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ./service-account.json
releaseFiles: ./dist/Spotube-playstore-all-arch.aab
packageName: oss.krtirtho.spotube
track: production
status: draft
releaseName: ${{ env.TAG_NAME }}