diff --git a/.github/workflows/build-aggregator.yaml b/.github/workflows/build-aggregator.yaml index 739b637..cd3838d 100644 --- a/.github/workflows/build-aggregator.yaml +++ b/.github/workflows/build-aggregator.yaml @@ -4,7 +4,7 @@ on: push: branches: [ master ] tags: - - '*' + - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: branches: [ master ] paths: ['aggregator/**'] @@ -16,6 +16,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Write release version + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Set up JDK 21 uses: actions/setup-java@v3 with: @@ -66,4 +73,4 @@ jobs: context: aggregator/ file: aggregator/src/main/docker/Dockerfile.jvm push: true - tags: spoud/kafka-cost-control:${{ github.ref_name }} + tags: spoud/kafka-cost-control:${VERSION} diff --git a/.github/workflows/build-frontend.yaml b/.github/workflows/build-frontend.yaml index 97e14d1..68f11b8 100644 --- a/.github/workflows/build-frontend.yaml +++ b/.github/workflows/build-frontend.yaml @@ -4,7 +4,7 @@ on: push: branches: [ master ] tags: - - '*' + - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: branches: [ master ] paths: [ 'frontend/**' ] @@ -16,6 +16,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Write release version + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Install dependencies working-directory: frontend/ run: npm install @@ -72,4 +79,4 @@ jobs: with: context: frontend/ push: true - tags: spoud/kafka-cost-control-ui:${{ github.ref_name }} + tags: spoud/kafka-cost-control-ui:${VERSION} diff --git a/.github/workflows/build-kafka-connect.yaml b/.github/workflows/build-kafka-connect.yaml index 15d0633..98aeb90 100644 --- a/.github/workflows/build-kafka-connect.yaml +++ b/.github/workflows/build-kafka-connect.yaml @@ -4,7 +4,7 @@ on: push: branches: [ master ] tags: - - '*' + - 'v[0-9]+.[0-9]+.[0-9]+' paths: ['kafka-connect/**'] jobs: @@ -14,6 +14,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Write release version + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -34,4 +41,4 @@ jobs: with: context: kafka-connect/ push: true - tags: spoud/kafka-cost-control-connect:${{ github.ref_name }} + tags: spoud/kafka-cost-control-connect:${VERSION} diff --git a/.github/workflows/build-scraper.yaml b/.github/workflows/build-scraper.yaml index be0e7a6..b991970 100644 --- a/.github/workflows/build-scraper.yaml +++ b/.github/workflows/build-scraper.yaml @@ -4,7 +4,7 @@ on: push: branches: [ master ] tags: - - '*' + - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: branches: [ master ] paths: ['kafka-scraper/**'] @@ -16,6 +16,13 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Write release version + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Set up JDK 21 uses: actions/setup-java@v3 with: @@ -63,7 +70,7 @@ jobs: context: kafka-scraper/ file: kafka-scraper/src/main/docker/Dockerfile.jvm push: true - tags: spoud/kafka-cost-control-scraper:${{ github.ref_name }}-jvm + tags: spoud/kafka-cost-control-scraper:${VERSION}-jvm - name: Build and push tagged native image if: startsWith(github.ref, 'refs/tags/') @@ -72,4 +79,4 @@ jobs: context: kafka-scraper/ file: kafka-scraper/src/main/docker/Dockerfile.native-micro push: true - tags: spoud/kafka-cost-control-scraper:${{ github.ref_name }}-native + tags: spoud/kafka-cost-control-scraper:${VERSION}-native diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..08a381e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,24 @@ +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + - name: Create Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 04a30f5..503ac84 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,8 +39,8 @@ Releases are made through git tags using semantic versioning. Where `MAJOR.MINOR - `MINOR` version when you add functionality in a backwards compatible manner, and - `PATCH` version when you make backwards compatible bug fixes or dependencies update. -To create a release you should push a tag to the master branch. For example +To create a release you should push a tag starting with `v`to the master branch. For example ```bash -git tag 0.1.2 +git tag v0.1.2 git push --tags ```