diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db0f1b76..6a0e7184 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,45 +24,11 @@ jobs: with: fetch-depth: '0' - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'corretto' - cache: 'maven' - - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: | - ~/.m2/repository - !~/.m2/repository/org/devgateway/tcdi - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Configure Git user run: | git config user.email "tmugo@developmentgateway.org" git config user.name "Timothy Mugo Gachengo" - - name: Build the Maven project - run: | - mvn package -DskipTests=true -Dcheckstyle.skip \ - && mkdir -p forms/target/deps \ - && cd forms/target/deps \ - && jar -xf ../*.jar - - - name: Generate a changelog - uses: orhun/git-cliff-action@v3 - id: changelog - with: - config: cliff.toml - env: - OUTPUT: CHANGELOG.md - GITHUB_REPO: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Generate Tag id: tag_version uses: mathieudutour/github-tag-action@v6.2 @@ -73,8 +39,11 @@ jobs: dry_run: 'true' build-and-push-docker-image: - needs: release-and-tag + needs: prepare-a-release runs-on: ubuntu-latest + outputs: + new_version: ${{ needs.prepare-a-release.outputs.new_version }} + new_tag: ${{ needs.prepare-a-release.outputs.new_tag }} steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -103,22 +72,61 @@ jobs: context: . push: true build-args: | - VERSION=${{ needs.release-and-tag.outputs.new_version }} - TAG=${{ needs.release-and-tag.outputs.new_version }} + VERSION=${{ needs.prepare-a-release.outputs.new_version }} + TAG=${{ needs.prepare-a-release.outputs.new_tag }} tags: | ${{ vars.DOCKER_REGISTRY }}/data-viz-admin:latest - ${{ vars.DOCKER_REGISTRY }}/data-viz-admin:v${{ needs.release-and-tag.outputs.new_version }} + ${{ vars.DOCKER_REGISTRY }}/data-viz-admin:v${{ needs.prepare-a-release.outputs.new_version }} release-on-github: needs: build-and-push-docker-image runs-on: ubuntu-latest steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: '0' + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'corretto' + cache: 'maven' + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/devgateway/tcdi + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build the Maven project + run: | + mvn package -DskipTests=true -Dcheckstyle.skip \ + && mkdir -p forms/target/deps \ + && cd forms/target/deps \ + && jar -xf ../*.jar + + - name: Generate a changelog + uses: orhun/git-cliff-action@v3 + id: changelog + with: + config: cliff.toml + env: + OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release id: create_release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ needs.release-and-tag.outputs.new_tag }} - files: forms/target/deps/*.jar + tag_name: ${{ needs.build-and-push-docker-image.outputs.new_tag }} + files: forms/target/*.jar body_path: CHANGELOG.md draft: false prerelease: false diff --git a/cliff.toml b/cliff.toml index 1161ff27..de53f3bc 100644 --- a/cliff.toml +++ b/cliff.toml @@ -83,4 +83,7 @@ filter_commits = false # sort the tags topologically topo_order = false # sort the commits inside sections by oldest/newest order -sort_commits = "newest" \ No newline at end of file +sort_commits = "newest" + +[bump] +initial_tag = "v1.0.0" \ No newline at end of file