107 lines
3.4 KiB
YAML
107 lines
3.4 KiB
YAML
---
|
|
name: Bump version and sync Changelog to Docker Repo
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "CHANGELOG.md"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: bump-and-sync-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
bump_and_sync:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.ref }}
|
|
|
|
- name: Extract version from commit message
|
|
id: ver
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
MSG="${{ github.event.head_commit.message }}"
|
|
if [[ "$MSG" =~ release\((v[0-9]+\.[0-9]+\.[0-9]+)\) ]]; then
|
|
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
|
|
echo "Found version: ${BASH_REMATCH[1]}"
|
|
else
|
|
echo "version=" >> "$GITHUB_OUTPUT"
|
|
echo "No release(vX.Y.Z) tag in commit message; skipping bump."
|
|
fi
|
|
|
|
- name: Update public/js/version.js (source of truth)
|
|
if: steps.ver.outputs.version != ''
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cat > public/js/version.js <<'EOF'
|
|
// generated by CI
|
|
window.APP_VERSION = '${{ steps.ver.outputs.version }}';
|
|
EOF
|
|
|
|
- name: Sync with remote (rebase)
|
|
if: steps.ver.outputs.version != ''
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git fetch origin ${{ github.ref_name }}
|
|
# ensure we're on a local branch that tracks the remote
|
|
git checkout -B ${{ github.ref_name }} --track origin/${{ github.ref_name }} || git checkout -B ${{ github.ref_name }}
|
|
git pull --rebase origin ${{ github.ref_name }}
|
|
|
|
- name: Commit version.js only
|
|
if: steps.ver.outputs.version != ''
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add public/js/version.js
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
else
|
|
git commit -m "chore(release): set APP_VERSION to ${{ steps.ver.outputs.version }} [skip ci]"
|
|
git push origin ${{ github.ref_name }}
|
|
fi
|
|
|
|
- name: Checkout filerise-docker
|
|
if: steps.ver.outputs.version != ''
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: error311/filerise-docker
|
|
token: ${{ secrets.PAT_TOKEN }}
|
|
path: docker-repo
|
|
fetch-depth: 0
|
|
|
|
- name: Copy CHANGELOG.md and write VERSION
|
|
if: steps.ver.outputs.version != ''
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cp CHANGELOG.md docker-repo/CHANGELOG.md
|
|
echo "${{ steps.ver.outputs.version }}" > docker-repo/VERSION
|
|
|
|
- name: Commit & push to docker repo
|
|
if: steps.ver.outputs.version != ''
|
|
working-directory: docker-repo
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add CHANGELOG.md VERSION
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
else
|
|
git commit -m "chore: sync CHANGELOG.md + VERSION (${{ steps.ver.outputs.version }}) from FileRise"
|
|
git push origin main
|
|
fi
|