Skip to content

Sync latest core release #337

Sync latest core release

Sync latest core release #337

name: Sync latest core release
# We pull from here to prevent too much coupling to the core repo.
on:
workflow_dispatch:
schedule:
- cron: "0 19 * * *"
jobs:
sync-core-release:
runs-on: ubuntu-latest
permissions:
contents: read
# Not required as we use CI_PAT directly so we can trigger workflows
# pull-requests: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT }}
- id: get-core-release
run: |
curl -sSfl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/calyptia/core/releases/latest
LATEST_RELEASE_TAG=$(curl -sSfl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/calyptia/core/releases/latest|jq -r .tag_name)
echo "Found tag for latest release: $LATEST_RELEASE_TAG"
echo "tag=$LATEST_RELEASE_TAG" >> $GITHUB_OUTPUT
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.CI_PAT }}
# Note we assume a simple version update so no chart version update
- name: Run the sed on the chart file
run: |
if [[ "$NEW_CALYPTIA_CORE_VERSION" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]] ; then
NEW_CALYPTIA_CORE_VERSION=${BASH_REMATCH[1]}
echo "Valid version string: $NEW_CALYPTIA_CORE_VERSION"
else
echo "ERROR: Invalid semver string: $NEW_CALYPTIA_CORE_VERSION"
exit 1
fi
sed -i "s/^version.*$/version: $NEW_CALYPTIA_CORE_VERSION/g" ./charts/core/Chart.yaml
sed -i "s/^appVersion.*$/appVersion: $NEW_CALYPTIA_CORE_VERSION/g" ./charts/core/Chart.yaml
echo "chart version=$NEW_CALYPTIA_CORE_VERSION" >> $GITHUB_OUTPUT
echo "app version=$NEW_CALYPTIA_CORE_VERSION" >> $GITHUB_OUTPUT
env:
NEW_CALYPTIA_CORE_VERSION: ${{ steps.get-core-release.outputs.tag }}
shell: bash
- name: Generate PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'ci: update to latest core version'
signoff: true
branch: ci_update_core
delete-branch: true
title: 'ci: update to latest core version'
# We need workflows permission so have to use the CI_PAT
token: ${{ secrets.CI_PAT }}
labels: ci,automerge
body: |
Update core version
- Created by ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- Auto-generated by create-pull-request: https://github.com/peter-evans/create-pull-request
draft: false