Update KoLmafia #42
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: Update KoLmafia | |
on: | |
workflow_dispatch: | |
inputs: | |
revision: | |
description: "KoLmafia revision" | |
default: "latest" | |
type: string | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
current-revision: ${{ steps.get-current-revision.outputs.current-revision }} | |
desired-revision: ${{ steps.determine-desired-revision.outputs.desired-revision }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get current revision | |
id: get-current-revision | |
run: echo "current-revision=$(cat .kolmafia-revision)" >> $GITHUB_OUTPUT | |
- name: Determine desired revision | |
id: determine-desired-revision | |
run: | | |
echo "desired-revision=$( | |
if [[ ${{ github.event.inputs.revision }} == "latest" ]]; then | |
curl https://api.github.com/repos/kolmafia/kolmafia/releases/latest -s | jq .name -r | |
else | |
echo ${{ github.event.inputs.revision }} | |
fi | |
)" >> $GITHUB_OUTPUT | |
update: | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.desired-revision > needs.check.outputs.current-revision | |
steps: | |
- name: Job Skipped Message | |
if: ${{ always() }} | |
run: | | |
if [ "${{ job.status }}" == "skipped" ]; then | |
echo "Job was skipped because it did not meet the condition." | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version-file: .java-version | |
distribution: temurin | |
- name: Update .kolmafia-revision | |
run: echo -n "${{ needs.check.outputs.desired-revision }}" > .kolmafia-revision | |
- name: Update ash/library.py | |
run: uv run python scripts/generate_ash_library.py | |
- name: Format | |
run: make format | |
continue-on-error: true | |
- name: Lint | |
run: make lint | |
- name: Test | |
run: make test | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: "Update KoLmafia to r${{ needs.check.outputs.desired-revision }}" |