diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6807163..88444bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,18 +10,47 @@ on: jobs: version: - uses: ./.github/workflows/task-version.yml + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Compute tag + id: version + uses: h2-invent/action-compute-tag@v2.2.0 + with: + event-name: ${{ github.event_name }} + base-ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.event.pull_request.base.ref }} + pr-action: ${{ github.event.action }} + pr-merged: ${{ github.event.pull_request.merged }} + + - name: Create new Release with semantic-version tag + uses: ncipollo/release-action@v1 + id: create_release + with: + draft: false + prerelease: false + allowUpdates: true + name: Release ${{ steps.version.outputs.version }} + tag: ${{ steps.version.outputs.version }} + bodyFile: RELEASE_NOTE.md docker_image: needs: - version uses: ./.github/workflows/task-docker.yml + if: needs.version.outputs.skip != 'true' with: registry: reg.h2-invent.com dockerfile_path: './Dockerfile' directory: '.' - version: ${{ needs.version.outputs.version_output }} - tags: reg.h2-invent.com/filemanager/core:${{ needs.version.outputs.version_output }},reg.h2-invent.com/filemanager/core:latest + version: ${{ needs.version.outputs.version }} + tags: reg.h2-invent.com/filemanager/core:${{ needs.version.outputs.version }},reg.h2-invent.com/filemanager/core:latest secrets: docker_password: ${{ secrets.HARBOR_PUSH_PASSWORD }} docker_username: ${{ secrets.HARBOR_PUSH_USERNAME }} + diff --git a/.github/workflows/task-release.yml b/.github/workflows/task-release.yml deleted file mode 100644 index a4ae7fa..0000000 --- a/.github/workflows/task-release.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release Version - -on: - workflow_call: - inputs: - version: - description: 'release version' - default: true - type: string -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Create new Release with semantic-version tag - uses: ncipollo/release-action@v1 - with: - draft: false - prerelease: false - allowUpdates: true - name: Release ${{ inputs.version }} - tag: ${{ inputs.version }} - bodyFile: RELEASE_NOTE.md diff --git a/.github/workflows/task-version.yml b/.github/workflows/task-version.yml deleted file mode 100644 index 0b25dc9..0000000 --- a/.github/workflows/task-version.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Publish Docker image - -on: - workflow_call: - outputs: - version_output: - description: Output next build version - value: ${{ jobs.detect_version.outputs.version }} -jobs: - detect_version: - name: Generate new Release Version - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Check out the repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: paulhatch/semantic-version@v5.0.2 - id: version - with: - tag_prefix: "" - major_pattern: "(MAJOR)" - minor_pattern: "(MINOR)" - change_path: . - version_format: "${major}.${minor}.${patch}" - - - name: Create new Release with semantic-version tag - uses: ncipollo/release-action@v1 - id: create_release - with: - draft: false - prerelease: false - allowUpdates: true - name: Release ${{ steps.version.outputs.version }} - tag: ${{ steps.version.outputs.version }} - bodyFile: RELEASE_NOTE.md