-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.86 KB
/
update-mingw-package.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: MINGW Package Update
on:
workflow_dispatch:
inputs:
dryrun:
description: 'Do a dry run of the package update process, without making the commit/PR'
required: false
type: boolean
workflow_call:
inputs:
dryrun:
required: true
type: boolean
jobs:
update-mingw-package:
name: Update MINGW Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout GMLC-TDC/MINGW-packages
uses: actions/checkout@v4
with:
repository: 'GMLC-TDC/MINGW-packages'
token: ${{ secrets.HELICS_PACKAGING_TOKEN }}
path: 'MINGW-packages'
- name: Sync MINGW-packages fork with upstream
working-directory: 'MINGW-packages'
env:
GH_TOKEN: ${{ secrets.HELICS_PACKAGING_TOKEN }}
run: gh api repos/{owner}/{repo}/merge-upstream --field branch='{branch}'
- name: Set git config for commits
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Update HELICS mingw package
env:
GH_TOKEN: ${{ secrets.HELICS_PACKAGING_TOKEN }}
run: |
# Get HELICS version update info
HELICS_VERSION="$(cat HELICS_VERSION)"
HELICS_SHA256SUMS=$(wget "https://github.com/GMLC-TDC/HELICS/releases/download/v${HELICS_VERSION}/Helics-v${HELICS_VERSION}-SHA-256.txt" -q -O -)
HELICS_TARNAME="Helics-v${HELICS_VERSION}-source.tar.gz"
HELICS_SHA256="$(echo "${HELICS_SHA256SUMS}" | grep -h "Helics-v${HELICS_VERSION}-source.tar.gz" | cut -d " " -f 1)"
# Update lines in the package file
echo "::group::git pull"
cd "MINGW-packages/mingw-w64-helics" && git pull
echo "::endgroup::"
PKGVER_LINE="pkgver=${HELICS_VERSION}"
SHA256SUMS_LINE="sha256sums=('${HELICS_SHA256}')"
echo "::group::pkgver line"
echo "$PKGVER_LINE"
echo "::endgroup::"
echo "::group::sha256sums line"
echo "$SHA256SUMS_LINE"
echo "::endgroup::"
sed -i "/pkgver=/c ${PKGVER_LINE}" PKGBUILD
sed -i "/sha256sums=/c ${SHA256SUMS_LINE}" PKGBUILD
# Commit the change and create a PR
git checkout -b "helics-${HELICS_VERSION}"
git add PKGBUILD .
echo "::group::git diff --staged"
git diff --staged
echo "::endgroup::"
git commit -m "helics: Update to ${HELICS_VERSION}"
echo "::group::git show"
git show
echo "::endgroup::"
if [ "${{ inputs.dryrun }}" = "false" ]; then
echo "Pushing changes and opening a PR"
git push --set-upstream origin "helics-${HELICS_VERSION}"
gh pr create --repo msys2/MINGW-packages --title "helics: Update to ${HELICS_VERSION}" --body "Update to the HELICS ${HELICS_VERSION} release"
fi