MINGW Package Update #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |