Skip to content

Auto-version

Auto-version #24

Workflow file for this run

on:
workflow_dispatch:
schedule:
- cron: "30 2 * * *"
name: Auto-version
jobs:
auto-version:
runs-on: ubuntu-latest
environment: hermit-autoversion
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.HERMIT_APP_ID }}
private-key: ${{ secrets.HERMIT_APP_PRIVATE_KEY }}
- name: Get app user id
id: app-user
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
echo "id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.app-token.outputs.token }}
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Auto-version
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
APP_USER_ID: ${{ steps.app-user.outputs.id }}
run: |
set -xe
hermit -d manifest auto-version --continue-on-error --update-digests $(ls -1 *.hcl | shuf)
curl --header "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/rate_limit
if git diff --exit-code HEAD; then
echo "No change"
exit 0
fi
git config --global user.email "${APP_USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
git config --global user.name "${APP_SLUG}[bot]"
git commit -am "Auto-versioned: $(git diff --name-only | paste -s -d ' ' -)"
git push