|
| 1 | +name: Create release + SMP + package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: 'Release tag: (X.X.X)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + title: |
| 11 | + description: 'Release title:' |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + |
| 15 | +jobs: |
| 16 | + # Create new release + Tag |
| 17 | + release: |
| 18 | + name: 'Create release' |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4.1.1 |
| 23 | + - name: Bump version and push tag |
| 24 | + uses: mathieudutour/github-tag-action@v6.1 |
| 25 | + with: |
| 26 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + custom_tag: ${{ inputs.tag }} |
| 28 | + tag_prefix: 'v' |
| 29 | + - name: 'Create readme header' |
| 30 | + shell: bash |
| 31 | + working-directory: '.' |
| 32 | + run: | |
| 33 | + cp .github/RELEASE_HEAD.md RELEASE_HEAD.md |
| 34 | + - name: 'Create release notes' |
| 35 | + uses: CSchoel/release-notes-from-changelog@v1.3.0 |
| 36 | + with: |
| 37 | + version: ${{ inputs.tag }} |
| 38 | + - name: 'Create Release using GitHub CLI' |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + run: > |
| 42 | + gh release create |
| 43 | + --verify-tag |
| 44 | + --latest |
| 45 | + -F RELEASE.md |
| 46 | + -t 'v${{ inputs.tag }} - ${{ inputs.title }}' |
| 47 | + 'v${{ inputs.tag }}' |
| 48 | + # Attach assets |
| 49 | + mod: |
| 50 | + needs: release |
| 51 | + name: 'Attach SMP mod' |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: 'Get binaries' |
| 56 | + run: | |
| 57 | + curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ |
| 58 | + -H 'Accept: application/vnd.github.v4.raw' \ |
| 59 | + -O \ |
| 60 | + -L https://api.github.com/repos/regorxxx/foobar2000-assets/contents/Spider%20Monkey%20Panel/foo_spider_monkey_panel-v1.6.1-mod.fb2k-component |
| 61 | + - uses: AButler/upload-release-assets@v3.0 |
| 62 | + with: |
| 63 | + files: 'foo_spider_monkey_panel-v1.6.1-mod.fb2k-component' |
| 64 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + release-tag: 'v${{ inputs.tag }}' |
| 66 | + # Build and attach package |
| 67 | + package: |
| 68 | + needs: release |
| 69 | + name: 'Attach Package' |
| 70 | + runs-on: windows-latest |
| 71 | + |
| 72 | + steps: |
| 73 | + - uses: thaitype/actions-switch-case@v1 |
| 74 | + id: switch-case |
| 75 | + with: |
| 76 | + default: '0' |
| 77 | + conditionals-with-values: | |
| 78 | + ${{ 'World-Map-SMP' == github.event.repository.name }} => '1' |
| 79 | + ${{ 'Playlist-Manager-SMP' == github.event.repository.name }} => '2' |
| 80 | + ${{ 'Not-a-Waveform-Seekbar-SMP' == github.event.repository.name }} => '3' |
| 81 | + ${{ 'Timeline-SMP' == github.event.repository.name }} => '4' |
| 82 | + - uses: actions/checkout@v4.1.1 |
| 83 | + if: ${{ steps.switch-case.outputs.match != '0' }} |
| 84 | + - name: 'Create package' |
| 85 | + if: ${{ steps.switch-case.outputs.match != '0'}} |
| 86 | + run: ./_createPackage.bat ${{ steps.switch-case.outputs.match }} |
| 87 | + - uses: AButler/upload-release-assets@v3.0 |
| 88 | + if: ${{ steps.switch-case.outputs.match != '0' }} |
| 89 | + with: |
| 90 | + files: 'packages/*.zip' |
| 91 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + release-tag: 'v${{ inputs.tag }}' |
| 93 | + - name: 'No package associated to repository' |
| 94 | + if: ${{ steps.switch-case.outputs.match == '0' }} |
| 95 | + run: echo 'No package associated' |
0 commit comments