-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (69 loc) · 2.83 KB
/
update.yml
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
name: Update a package
on:
workflow_dispatch:
inputs:
package:
description: 'Name of the launcher package to update'
required: true
type: choice
options:
- an-anime-game-launcher
- anime-games-launcher
- honkers-launcher
- the-honkers-railway-launcher
- sleepy-launcher
version:
description: 'Version of the package to generate, a github release tag'
required: true
type: string
jobs:
generate_update:
name: Generate update for ${{ inputs.package }} ${{ inputs.version }}
runs-on: ubuntu-latest
container:
image: ghcr.io/johnthecoolingfan/gentoo-action-image:latest
env:
PACKAGE_REF: "${{ inputs.version }}"
defaults:
run:
shell: bash
steps:
- name: Install pycargoebuild
run: emerge app-portage/pycargoebuild
# Normalize so that both X.Y.Z and vX.Y.Z are handled properly
- name: Normalize version
run: |
echo "PACKAGE_VERSION=${PACKAGE_REF#v}" >> $GITHUB_ENV
echo "NEW_PACKAGE_EBUILD=${{ inputs.package }}-${PACKAGE_REF#v}.ebuild" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
path: repo
- name: Checkout launcher repository
uses: actions/checkout@v4
with:
repository: "an-anime-team/${{ inputs.package }}"
ref: ${{ inputs.version }}
path: ${{ inputs.package }}
- name: Create new ebuild file
run: |
cp $( find "repo/games-misc/${{ inputs.package }}" -regextype sed -regex ".*/${{ inputs.package }}-[0-9]\+\.[0-9]\+\.[0-9]\+\.ebuild" | sort | tail -n1 ) "repo/games-misc/${{ inputs.package }}/${NEW_PACKAGE_EBUILD}"
- name: Run pycargoebuild
run: pycargoebuild --inplace "repo/games-misc/${{ inputs.package }}/${NEW_PACKAGE_EBUILD}" "./${{ inputs.package }}/"
- name: Run pkgcheck scan
working-directory: ./repo/games-misc/${{ inputs.package }}
run: pkgcheck scan
- name: Commit repository changes
working-directory: ./repo
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
pkgdev commit -m "games-misc/${{ inputs.package }}: add ${{ inputs.version }}"
- name: Create a pull request with the new ebuild
uses: peter-evans/create-pull-request@v6
with:
path: ./repo
branch: ${{ inputs.package }}-${{ inputs.version }}
title: "games-misc/${{ inputs.package }}: add ${{ inputs.version }}"
body: "Automated update to games-misc/${{ inputs.package }}: new version [${{ inputs.version }}](https://github.com/an-anime-team/${{ inputs.package }}/releases/tag/${{ inputs.version }})"