mirror of
https://github.com/Dvorinka/Dash.git
synced 2026-10-28 07:41:27 +00:00
Merge pull request #11 from Dvorinka/ci/release-on-main
ci(release): auto-tag and release when ci passes on main
This commit is contained in:
2 files changed
+81
-5
No files matched your search
@@ -1,20 +1,89 @@
|
|||||||
name: release
|
name: release
|
||||||
|
|
||||||
|
# Releases are cut automatically from main: after the ci workflow passes on a
|
||||||
|
# main push, the version job bumps semver from conventional commit subjects
|
||||||
|
# (BREAKING/! -> major, feat -> minor, otherwise patch), pushes the tag, and
|
||||||
|
# the build jobs release it. Manual tags are not used; workflow_dispatch
|
||||||
|
# re-runs the same flow on demand.
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
tags: ["v*"]
|
workflows: [ci]
|
||||||
|
types: [completed]
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
|
# Two merges racing would compute the same tag; serialize instead.
|
||||||
|
concurrency:
|
||||||
|
group: release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.v.outputs.version }}
|
||||||
|
semver: ${{ steps.v.outputs.semver }}
|
||||||
|
major_minor: ${{ steps.v.outputs.major_minor }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
||||||
|
|
||||||
|
- id: v
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
latest="$(git tag -l 'v*' --sort=-v:refname | head -n1)"
|
||||||
|
if [ -z "$latest" ]; then
|
||||||
|
version="v0.1.0"; bump="minor"
|
||||||
|
else
|
||||||
|
subjects="$(git log "$latest"..HEAD --format=%s)"
|
||||||
|
if grep -qiE 'BREAKING[ -]CHANGE|^[a-z]+(\([^)]*\))?!:' <<< "$subjects"; then
|
||||||
|
bump="major"
|
||||||
|
elif grep -qE '^feat(\([^)]*\))?:' <<< "$subjects"; then
|
||||||
|
bump="minor"
|
||||||
|
else
|
||||||
|
bump="patch"
|
||||||
|
fi
|
||||||
|
IFS=. read -r major minor patch <<< "${latest#v}"
|
||||||
|
case "$bump" in
|
||||||
|
major) major=$((major+1)); minor=0; patch=0 ;;
|
||||||
|
minor) minor=$((minor+1)); patch=0 ;;
|
||||||
|
*) patch=$((patch+1)) ;;
|
||||||
|
esac
|
||||||
|
version="v${major}.${minor}.${patch}"
|
||||||
|
fi
|
||||||
|
semver="${version#v}"
|
||||||
|
IFS=. read -r mj mn _ <<< "$semver"
|
||||||
|
{
|
||||||
|
echo "version=$version"
|
||||||
|
echo "semver=$semver"
|
||||||
|
echo "major_minor=$mj.$mn"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
echo "latest=${latest:-none} bump=$bump -> $version"
|
||||||
|
|
||||||
|
- name: Push tag
|
||||||
|
env:
|
||||||
|
VERSION: ${{ steps.v.outputs.version }}
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git tag "$VERSION"
|
||||||
|
git push origin "$VERSION"
|
||||||
|
|
||||||
binaries:
|
binaries:
|
||||||
|
needs: version
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # goreleaser needs full history for tag + changelog
|
fetch-depth: 0 # goreleaser needs full history for tag + changelog
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
@@ -40,11 +109,15 @@ jobs:
|
|||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GORELEASER_CURRENT_TAG: ${{ needs.version.outputs.version }}
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
needs: version
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
@@ -59,8 +132,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository }}
|
images: ghcr.io/${{ github.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{version}}
|
type=raw,value=${{ needs.version.outputs.semver }}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=raw,value=${{ needs.version.outputs.major_minor }}
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
|
||||||
- uses: docker/build-push-action@v6
|
- uses: docker/build-push-action@v6
|
||||||
|
|||||||
+4
-1
@@ -6,6 +6,8 @@ All notable changes to Dash. Format follows
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.1.0] — 2026-09-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Domain detail now identifies vendors per record: A/AAAA/CNAME/NS/MX/TXT
|
- Domain detail now identifies vendors per record: A/AAAA/CNAME/NS/MX/TXT
|
||||||
@@ -124,7 +126,8 @@ All notable changes to Dash. Format follows
|
|||||||
- Single Go binary serving the embedded React UI; SQLite via goose migrations;
|
- Single Go binary serving the embedded React UI; SQLite via goose migrations;
|
||||||
Docker image on distroless
|
Docker image on distroless
|
||||||
|
|
||||||
[Unreleased]: https://github.com/Dvorinka/Dash/compare/v2.0.0...HEAD
|
[Unreleased]: https://github.com/Dvorinka/Dash/compare/v2.1.0...HEAD
|
||||||
|
[2.1.0]: https://github.com/Dvorinka/Dash/compare/v2.0.0...v2.1.0
|
||||||
[2.0.0]: https://github.com/Dvorinka/Dash/compare/v0.7.0...v2.0.0
|
[2.0.0]: https://github.com/Dvorinka/Dash/compare/v0.7.0...v2.0.0
|
||||||
[0.7.0]: https://github.com/Dvorinka/Dash/compare/v0.6.0...v0.7.0
|
[0.7.0]: https://github.com/Dvorinka/Dash/compare/v0.6.0...v0.7.0
|
||||||
[0.6.0]: https://github.com/Dvorinka/Dash/compare/v0.5.0...v0.6.0
|
[0.6.0]: https://github.com/Dvorinka/Dash/compare/v0.5.0...v0.6.0
|
||||||
|
|||||||
Reference in new issue
Block a user