Skip to content

Commit

Permalink
Merge pull request #18 from SergeiSizov/main
Browse files Browse the repository at this point in the history
Automatic semantic versioning for knowledge base images
  • Loading branch information
tetris4 authored Sep 20, 2024
2 parents 8861c5f + 6bcc8d9 commit e9d3f38
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/knowledge-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,34 @@ on:
- "knowledge-base/**"

jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.SHOULD_PUSH == 'true'
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [build]
steps:
- name: Print tag
run: echo ${{ needs.build.outputs.new_tag }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -34,7 +56,7 @@ jobs:
context: knowledge-base/.
platforms: linux/amd64,linux/arm64
push: true
tags: cecg/knowledge-platform:latest
tags: cecg/knowledge-platform:${{ needs.build.outputs.new_tag }}

repository-dispatch:
runs-on: ubuntu-latest
Expand All @@ -45,4 +67,4 @@ jobs:
with:
token: ${{ secrets.GIT_TOKEN }}
repository: coreeng/cecg-knowledge-platform-deployment
event-type: dispatch-event
event-type: dispatch-event
8 changes: 8 additions & 0 deletions knowledge-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ hugo serve
```

> **_NOTE:_** With Hugo, you can see your changes live as you make them.
## Versioning and releasing

We use semantic versioning: `v{major}.{minor}.{patch}`, e.g. `v0.1.0`.

Merging a pull request will generate a new **minor** version, and a **tag** will be automatically created in the repository.

Next, an image will be built and pushed to the Docker repository with the new version.

0 comments on commit e9d3f38

Please sign in to comment.