Skip to content

Find the latest MapTool version #83

Find the latest MapTool version

Find the latest MapTool version #83

name: Find the latest MapTool version
on:
schedule:
# Runs every few hours
- cron: '15 */4 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "find-release"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
changes_detected: ${{ steps.commit.outputs.changes_detected }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Retrieve MapTool versions
uses: octokit/request-action@v3.x
id: find-release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: RPTools
repo: maptool
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Write release asset links
id: write-release
env:
RELEASE_JSON: ${{ steps.find-release.outputs.data }}
run: |
release_organizer=$(cat <<'EOF'
{
"version": .tag_name,
"release-page": .html_url,
"release-date": .published_at,
"assets": .assets | [ .[] | .browser_download_url ] | {
"windows": {
"exe": map(select(test("\\.exe$"))) | first,
"msi": map(select(test("\\.msi$"))) | first,
"zip": map(select(test("win.*\\.zip$"))) | first
},
"mac": {
"dmg": map(select(test("\\.dmg$"))) | first,
"pkg": map(select(test("\\.pkg$"))) | first,
"zip": map(select(test("mac.*\\.zip$"))) | first
},
"linux": {
"deb": map(select(test("\\.deb$"))) | first,
"rpm": map(select(test("\\.rpm$"))) | first,
"arch": map(select(test("\\.pkg.tar.zst$"))) | first,
"zip": map(select(test("linux.*\\.zip$"))) | first
}
}
}
EOF
)
echo "$RELEASE_JSON" | jq "${release_organizer}" > _data/releases/maptool.yml
cat _data/releases/maptool.yml
printf '%s=%s\n' 'version' $(cat '_data/releases/maptool.yml' | jq -r '.version') >> "$GITHUB_OUTPUT"
- name: Commit and Push changes
id: commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Update MapTool to ${{ steps.write-release.outputs.version }}"
deploy-pages:
needs: build
if: needs.build.outputs.changes_detected == 'true'
uses: ./.github/workflows/jekyll-gh-pages.yml