ci: fix version displayed

This commit is contained in:
CommunityMaintained 2026-06-14 13:45:17 -05:00
parent e08570bb7d
commit 1dc2af9c3a

View file

@ -63,10 +63,11 @@ jobs:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# After a release is published: update mix.exs to CalVer so the running app
# reports the date-based version while GitHub releases/tags stay semver.
# After a release is published: update mix.exs to "semver (calver)" so the
# running app displays both (e.g. "1.0.0 (2026-06-14)").
# Mix will warn that this isn't strict semver, which is fine for a Docker app.
update-mix-version:
name: Update mix.exs to CalVer
name: Update mix.exs version string
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
@ -79,18 +80,21 @@ jobs:
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump mix.exs version to today's CalVer
- name: Set combined version in mix.exs
run: |
SEMVER=$(echo '${{ needs.release-please.outputs.tag_name }}' | sed 's/^v//')
DATE=$(date +"%Y.%-m.%-d")
CURRENT=$(grep 'version: ' mix.exs | cut -d '"' -f2)
sed -i "s/version: \"$CURRENT\"/version: \"$DATE\"/" mix.exs
DISPLAY="${SEMVER} (${DATE})"
sed -i "s|^ version: \".*\",| version: \"${DISPLAY}\",|" mix.exs
- name: Commit and push
run: |
SEMVER=$(echo '${{ needs.release-please.outputs.tag_name }}' | sed 's/^v//')
DATE=$(date +"%Y.%-m.%-d")
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add mix.exs
git diff --cached --quiet || git commit -m "chore: update app version to $(date +"%Y.%-m.%-d") [skip ci]"
git diff --cached --quiet || git commit -m "chore: set app version to ${SEMVER} (${DATE}) [skip ci]"
git push
docker: