Skip to content

Update

Update #78

name: Update
on:
# Runs at 10:00 UTC every day
schedule:
- cron: '0 10 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync-candidate:
name: 🔄 Sync version with upstream
environment: "Candidate Branch"
runs-on: ubuntu-latest
steps:
- name: 🔄 Sync version with upstream
uses: snapcrafters/ci/sync-version@main
with:
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
update-script: |
TAG=$(
curl --fail --silent --show-error --location \
"https://api.github.com/repos/audacity/audacity/releases/latest" |
jq --exit-status --raw-output \
'.tag_name | select(type == "string" and startswith("Audacity-"))'
)
VERSION="${TAG#Audacity-}"
if [[ ! "$VERSION" =~ ^[0-9]+([.][0-9]+){2}([+-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid upstream version: $VERSION" >&2
exit 1
fi
sed -i 's/^\(version: \).*$/\1'"$VERSION"'/' snap/snapcraft.yaml