docs: rewrite readme following the new webui design #35
This file contains hidden or 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: Build and Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to push tags and create releases | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper tagging | |
| token: ${{ secrets.GITHUB_TOKEN }} # Use token for authentication | |
| - name: Generate version tag | |
| id: version | |
| run: | | |
| # Generate version based on timestamp and short commit hash | |
| VERSION="v$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Generated version: $VERSION" | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| # Get the latest tag (if exists) | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$LATEST_TAG" ]; then | |
| # No previous tag, get all commits | |
| COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges) | |
| CONTRIBUTORS=$(git log --pretty=format:"%an" --no-merges | sort -u) | |
| else | |
| # Get commits since last tag | |
| COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges) | |
| CONTRIBUTORS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%an" --no-merges | sort -u) | |
| fi | |
| # Format contributors with @ prefix for GitHub mentions | |
| FORMATTED_CONTRIBUTORS="" | |
| while IFS= read -r author; do | |
| if [ ! -z "$author" ]; then | |
| FORMATTED_CONTRIBUTORS="${FORMATTED_CONTRIBUTORS}- ${author}\n" | |
| fi | |
| done <<< "$CONTRIBUTORS" | |
| # Save commits to output (handle multiline) | |
| echo "commits<<EOF" >> $GITHUB_OUTPUT | |
| echo "$COMMITS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # Save contributors to output (handle multiline) | |
| echo "contributors<<EOF" >> $GITHUB_OUTPUT | |
| echo -e "$FORMATTED_CONTRIBUTORS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "Previous tag: ${LATEST_TAG:-none}" | |
| echo "Commits since last release:" | |
| echo "$COMMITS" | |
| echo "" | |
| echo "Contributors:" | |
| echo -e "$FORMATTED_CONTRIBUTORS" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: soulkyu | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker images | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # Build and push WebUI image | |
| docker build -t soulkyu/notificator-webui:${VERSION} -t soulkyu/notificator-webui:latest -f Dockerfile.webui . | |
| docker push soulkyu/notificator-webui:${VERSION} | |
| docker push soulkyu/notificator-webui:latest | |
| # Build and push Backend image | |
| docker build -t soulkyu/notificator-backend:${VERSION} -t soulkyu/notificator-backend:latest -f Dockerfile.backend . | |
| docker push soulkyu/notificator-backend:${VERSION} | |
| docker push soulkyu/notificator-backend:latest | |
| # Build and push Alertmanager image | |
| cd alertmanager/fake | |
| docker build -t soulkyu/notificator-alertmanager:${VERSION} -t soulkyu/notificator-alertmanager:latest -f Dockerfile . | |
| docker push soulkyu/notificator-alertmanager:${VERSION} | |
| docker push soulkyu/notificator-alertmanager:latest | |
| - name: Create and push tag | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git tag ${{ steps.version.outputs.version }} | |
| git push origin ${{ steps.version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| name: Release ${{ steps.version.outputs.version }} | |
| body: | | |
| ## Commits | |
| ${{ steps.changelog.outputs.commits }} | |
| ## Contributors | |
| Thanks to everyone who contributed to this release! :heart: | |
| ${{ steps.changelog.outputs.contributors }} | |
| ## Docker Images | |
| Docker images are available on Docker Hub with this version tag: | |
| - `soulkyu/notificator-webui:${{ steps.version.outputs.version }}` | |
| - `soulkyu/notificator-backend:${{ steps.version.outputs.version }}` | |
| - `soulkyu/notificator-alertmanager:${{ steps.version.outputs.version }}` | |
| Also tagged as `:latest` for convenience. | |
| ## Usage | |
| Pull and run the images: | |
| ```bash | |
| docker pull soulkyu/notificator-webui:${{ steps.version.outputs.version }} | |
| docker pull soulkyu/notificator-backend:${{ steps.version.outputs.version }} | |
| docker pull soulkyu/notificator-alertmanager:${{ steps.version.outputs.version }} | |
| ``` | |
| draft: false | |
| prerelease: false |