-
-
Notifications
You must be signed in to change notification settings - Fork 21
117 lines (107 loc) · 4.34 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Release New Version
on:
workflow_run:
# Run this workflow right after the build succeeds and test pass on the main branch
workflows: ["Build Artifacts"]
types: [completed]
branches:
- main
workflow_dispatch:
# Allow manual triggering of this workflow
inputs:
run-id:
type: string
description: "Workflow run ID"
required: false
dry-run:
type: boolean
description: "Skip release steps"
required: false
default: true
permissions:
contents: read
jobs:
check-release-version:
name: Check Release Version
if: github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/main' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- name: Check Out Source
uses: actions/checkout@v4
with:
fetch-depth: 0 # To ensure we have all tags
- name: Get Latest Changelog Version
id: changelog
uses: release-flow/keep-a-changelog-action@v3
with:
command: query
version: latest
- name: Get the Newest Tag
id: newest-tag
run: |
echo "newest-tag=`git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=-v:refname | head -n1 | cut -c2-`" >> "$GITHUB_OUTPUT"
outputs:
newest-version: ${{ steps.changelog.outputs.version }}
newest-tag: ${{ steps.newest-tag.outputs.version }}
release-notes: ${{ steps.changelog.outputs.release-notes}}
create-release:
name: Create Release
needs: check-release-version
if: "${{ needs.check-release-version.outputs.newest-tag != needs.check-release-version.outputs.newest-version }}"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Token required to download artifacts from other workflows in this run
run-id: '${{ inputs.run-id || github.event.workflow_run.id }}'
# Use the run ID from the input if provided, otherwise use the current run ID
path: artifact
# Download the artifacts to the `artifact` directory
- name: Zip Release Artifacts
shell: bash
working-directory: artifact
run: |
for file in melondsds_libretro-*-{Debug,Release,RelWithDebInfo}; do
zip -r "${file}.zip" "$file"
done
- name: Upload .info File Artifact
uses: actions/upload-artifact@v4
with:
name: melondsds_libretro.info
path: artifact/melondsds_libretro-linux-x86_64-Release/cores/melondsds_libretro.info
# The .info file doesn't vary by platform, so we only need to upload one
if-no-files-found: error
- name: Create Release
uses: softprops/action-gh-release@v2
if: "${{ !inputs.dry-run }}"
with:
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: "v${{ needs.check-release-version.outputs.newest-version }}"
body: "${{ needs.check-release-version.outputs.release-notes }}"
fail_on_unmatched_files: true
files: |
artifact/melondsds_libretro-*-Release.zip
artifact/melondsds_libretro-*-RelWithDebInfo.zip
artifact/melondsds_libretro-*-Debug.zip
- name: Checkout libretro-super
uses: actions/checkout@v4
with:
repository: "libretro/libretro-super"
path: libretro-super
- name: Add Updated .info File
run: |
cp -f "${{ github.workspace }}/artifact/melondsds_libretro-linux-x86_64-Release/cores/melondsds_libretro.info" libretro-super/dist/info/melondsds_libretro.info
- name: Open Pull Request
uses: peter-evans/create-pull-request@v6
if: "${{ !inputs.dry-run }}"
with:
token: ${{ secrets.RELEASE_TOKEN }}
path: libretro-super
commit-message: 'Submit melondsds_libretro.info for melonDS DS release v${{ needs.check-release-version.outputs.newest-version }} on behalf of @${{ github.triggering_actor }}'
title: "Update melonDS DS to ${{ needs.check-release-version.outputs.newest-version }}"
branch: "melondsds-v${{ needs.check-release-version.outputs.newest-version }}"
push-to-fork: "${{ github.triggering_actor }}/libretro-super"