Skip to content

Commit

Permalink
Automate actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
regorxxx committed Dec 8, 2023
1 parent 6af2d83 commit 664a2a3
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/RELEASE_HEAD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**There may be a SMP's bug on installation. See wiki.
REQUIRES SMP 1.6.1 (mod version attached has some improvements by [marc23](https://hydrogenaud.io/index.php/topic,116669.msg1026243.html#msg1026243))**

See full [changelog here](https://github.com/regorxxx/ListenBrainz-SMP/blob/main/CHANGELOG.md).
20 changes: 20 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Clean workflow runs (automatic)
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
# Run daily, at 00:00

jobs:
delete:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 0
keep_minimum_runs: 1
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Create release + SMP + package

on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag: (X.X.X)'
required: true
type: string
title:
description: 'Release title:'
required: false
type: string

jobs:
# Create new release + Tag
release:
name: 'Create release'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4.1.1
- name: Bump version and push tag
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ inputs.tag }}
tag_prefix: 'v'
- name: 'Create readme header'
shell: bash
working-directory: '.'
run: |
cp .github/RELEASE_HEAD.md RELEASE_HEAD.md
- name: 'Create release notes'
uses: CSchoel/release-notes-from-changelog@v1.3.0
with:
version: ${{ inputs.tag }}
- name: 'Create Release using GitHub CLI'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create
--verify-tag
--latest
-F RELEASE.md
-t 'v${{ inputs.tag }} - ${{ inputs.title }}'
'v${{ inputs.tag }}'
# Attach assets
mod:
needs: release
name: 'Attach SMP mod'
runs-on: ubuntu-latest

steps:
- name: 'Get binaries'
run: |
curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
-H 'Accept: application/vnd.github.v4.raw' \
-O \
-L https://api.github.com/repos/regorxxx/foobar2000-assets/contents/Spider%20Monkey%20Panel/foo_spider_monkey_panel-v1.6.1-mod.fb2k-component
- uses: AButler/upload-release-assets@v3.0
with:
files: 'foo_spider_monkey_panel-v1.6.1-mod.fb2k-component'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: 'v${{ inputs.tag }}'
# Build and attach package
package:
needs: release
name: 'Attach Package'
runs-on: windows-latest

steps:
- uses: thaitype/actions-switch-case@v1
id: switch-case
with:
default: '0'
conditionals-with-values: |
${{ 'World-Map-SMP' == github.event.repository.name }} => '1'
${{ 'Playlist-Manager-SMP' == github.event.repository.name }} => '2'
${{ 'Not-a-Waveform-Seekbar-SMP' == github.event.repository.name }} => '3'
${{ 'Timeline-SMP' == github.event.repository.name }} => '4'
- uses: actions/checkout@v4.1.1
if: ${{ steps.switch-case.outputs.match != '0' }}
- name: 'Create package'
if: ${{ steps.switch-case.outputs.match != '0'}}
run: ./_createPackage.bat ${{ steps.switch-case.outputs.match }}
- uses: AButler/upload-release-assets@v3.0
if: ${{ steps.switch-case.outputs.match != '0' }}
with:
files: 'packages/*.zip'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: 'v${{ inputs.tag }}'
- name: 'No package associated to repository'
if: ${{ steps.switch-case.outputs.match == '0' }}
run: echo 'No package associated'

0 comments on commit 664a2a3

Please sign in to comment.