From dd7bf5a5341aeb85de4518df05c3a436fc315158 Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 1 Aug 2025 11:46:17 +0300 Subject: [PATCH 1/9] FTC-1795 extract semantic version --- .github/workflows/semantic-version.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/semantic-version.yml diff --git a/.github/workflows/semantic-version.yml b/.github/workflows/semantic-version.yml new file mode 100644 index 0000000..b6246c4 --- /dev/null +++ b/.github/workflows/semantic-version.yml @@ -0,0 +1,24 @@ +name: Semantic version + +on: + workflow_call: + +jobs: + configure: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Configure build version + id: build + run: | + if [[ "${{github.ref_type}}" == "tag" ]]; then + version=$(echo ${{ github.ref }} | cut -d'/' -f3) + else + IFS='.' read -r major minor patch <<< "$(git tag | sort -V | tail -n 1)" + version="${major:-0}.$((minor + 1)).0" + fi + echo "version=$version" >> $GITHUB_OUTPUT + outputs: + version: ${{ steps.build.outputs.version }} From 7e2f4155703c5b18807d9a75ed7c24d4efdb42ec Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 1 Aug 2025 12:03:44 +0300 Subject: [PATCH 2/9] FTC-1795 semantic version action --- .github/workflows/semantic-version.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/semantic-version.yml b/.github/workflows/semantic-version.yml index b6246c4..cf2ced7 100644 --- a/.github/workflows/semantic-version.yml +++ b/.github/workflows/semantic-version.yml @@ -10,8 +10,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Configure build version - id: build + - name: Configure version + id: version run: | if [[ "${{github.ref_type}}" == "tag" ]]; then version=$(echo ${{ github.ref }} | cut -d'/' -f3) @@ -21,4 +21,4 @@ jobs: fi echo "version=$version" >> $GITHUB_OUTPUT outputs: - version: ${{ steps.build.outputs.version }} + version: ${{ steps.version.outputs.version }} From bbbeaa6d5bb367b5497a07f53df9f275158da83f Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 1 Aug 2025 12:15:57 +0300 Subject: [PATCH 3/9] FTC-1795 semantic version README --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index e485cad..93aed35 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,35 @@ jobs: aws-region: "us-east-1" source_dir: "./static/" s3_bucket: "my-bucket-name/static" +``` + +### Semantic version + +A reusable workflow for configuring semantic version based on previous versions + +#### Usage Example + +Create a workflow file (e.g., `.github/workflows/deploy.yml`) with the following content: + +```yaml +name: Build + +on: + push: + branches: [main, develop] + +jobs: + version: + uses: dashdevs/actions/.github/workflows/semantic-version.yml@main + id: version + outputs: + version: ${{ steps.version.version }} + + build: + needs: [version] + runs-on: ubuntu-latest + name: Build application + steps: + build: + run: echo "version is ${{ needs.version.outputs.version }}" +``` From bb1c6c6a46267cc618ce21719432b81c672ee822 Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 1 Aug 2025 15:36:10 +0300 Subject: [PATCH 4/9] FTC-1795 semantic version from workflow to actions --- .github/actions/semantic-version/action.yml | 27 +++++++++++++++++ .github/workflows/semantic-version.yml | 24 ---------------- README.md | 32 --------------------- 3 files changed, 27 insertions(+), 56 deletions(-) create mode 100644 .github/actions/semantic-version/action.yml delete mode 100644 .github/workflows/semantic-version.yml diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml new file mode 100644 index 0000000..2ae35b7 --- /dev/null +++ b/.github/actions/semantic-version/action.yml @@ -0,0 +1,27 @@ +name: "Semantic version" +description: "Configure semantic versioning based on git tags or branch names" +inputs: + github_ref_type: + description: "Type of GitHub reference (branch or tag)" + required: true + github_ref: + description: "GitHub reference (branch or tag name)" + required: true + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Configure version + id: version + run: | + if [[ "${{inputs.github_ref_type}}" == "tag" ]]; then + version=$(echo ${{ inputs.github_ref }} | cut -d'/' -f3) + else + IFS='.' read -r major minor patch <<< "$(git tag | sort -V | tail -n 1)" + version="${major:-0}.$((minor + 1)).0" + fi + echo "version=$version" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/workflows/semantic-version.yml b/.github/workflows/semantic-version.yml deleted file mode 100644 index cf2ced7..0000000 --- a/.github/workflows/semantic-version.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Semantic version - -on: - workflow_call: - -jobs: - configure: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Configure version - id: version - run: | - if [[ "${{github.ref_type}}" == "tag" ]]; then - version=$(echo ${{ github.ref }} | cut -d'/' -f3) - else - IFS='.' read -r major minor patch <<< "$(git tag | sort -V | tail -n 1)" - version="${major:-0}.$((minor + 1)).0" - fi - echo "version=$version" >> $GITHUB_OUTPUT - outputs: - version: ${{ steps.version.outputs.version }} diff --git a/README.md b/README.md index 93aed35..e485cad 100644 --- a/README.md +++ b/README.md @@ -81,35 +81,3 @@ jobs: aws-region: "us-east-1" source_dir: "./static/" s3_bucket: "my-bucket-name/static" -``` - -### Semantic version - -A reusable workflow for configuring semantic version based on previous versions - -#### Usage Example - -Create a workflow file (e.g., `.github/workflows/deploy.yml`) with the following content: - -```yaml -name: Build - -on: - push: - branches: [main, develop] - -jobs: - version: - uses: dashdevs/actions/.github/workflows/semantic-version.yml@main - id: version - outputs: - version: ${{ steps.version.version }} - - build: - needs: [version] - runs-on: ubuntu-latest - name: Build application - steps: - build: - run: echo "version is ${{ needs.version.outputs.version }}" -``` From 6fc530f8d8d5da25c8649cc918eaed99c787052c Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 1 Aug 2025 16:51:22 +0300 Subject: [PATCH 5/9] semantic version inputs removal --- .github/actions/semantic-version/action.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml index 2ae35b7..191f841 100644 --- a/.github/actions/semantic-version/action.yml +++ b/.github/actions/semantic-version/action.yml @@ -1,12 +1,5 @@ name: "Semantic version" description: "Configure semantic versioning based on git tags or branch names" -inputs: - github_ref_type: - description: "Type of GitHub reference (branch or tag)" - required: true - github_ref: - description: "GitHub reference (branch or tag name)" - required: true runs: using: composite @@ -17,8 +10,8 @@ runs: - name: Configure version id: version run: | - if [[ "${{inputs.github_ref_type}}" == "tag" ]]; then - version=$(echo ${{ inputs.github_ref }} | cut -d'/' -f3) + if [[ "${{ github.ref_type }}" == "tag" ]]; then + version=$(echo ${{ github.ref }} | cut -d'/' -f3) else IFS='.' read -r major minor patch <<< "$(git tag | sort -V | tail -n 1)" version="${major:-0}.$((minor + 1)).0" From 03a61c900386dd5f5cffcf2a9bb65cb1c85c3ab5 Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 8 Aug 2025 11:51:50 +0300 Subject: [PATCH 6/9] FTC-1795 output --- .github/actions/semantic-version/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml index 191f841..ec6c3cc 100644 --- a/.github/actions/semantic-version/action.yml +++ b/.github/actions/semantic-version/action.yml @@ -18,3 +18,8 @@ runs: fi echo "version=$version" >> $GITHUB_OUTPUT shell: bash + +outputs: + name: + description: Determined semantic version number + value: ${{ steps.version.outputs.number }} From 7ae47c168e5ab91358203c4fd3ec15e9ff7370c2 Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 8 Aug 2025 11:56:56 +0300 Subject: [PATCH 7/9] FTC-1795 output --- .github/actions/semantic-version/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml index ec6c3cc..348780e 100644 --- a/.github/actions/semantic-version/action.yml +++ b/.github/actions/semantic-version/action.yml @@ -11,15 +11,15 @@ runs: id: version run: | if [[ "${{ github.ref_type }}" == "tag" ]]; then - version=$(echo ${{ github.ref }} | cut -d'/' -f3) + calculated_version=$(echo ${{ github.ref }} | cut -d'/' -f3) else IFS='.' read -r major minor patch <<< "$(git tag | sort -V | tail -n 1)" - version="${major:-0}.$((minor + 1)).0" + calculated_version="${major:-0}.$((minor + 1)).0" fi - echo "version=$version" >> $GITHUB_OUTPUT + echo "calculated_version=$calculated_version" >> $GITHUB_OUTPUT shell: bash outputs: name: description: Determined semantic version number - value: ${{ steps.version.outputs.number }} + value: ${{ steps.version.outputs.calculated_version }} From 92238db6bf566017b22a95e4f0360eb857bf7b45 Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 8 Aug 2025 12:03:33 +0300 Subject: [PATCH 8/9] FTC-1795 output --- .github/actions/semantic-version/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml index 348780e..a018ce1 100644 --- a/.github/actions/semantic-version/action.yml +++ b/.github/actions/semantic-version/action.yml @@ -17,6 +17,7 @@ runs: calculated_version="${major:-0}.$((minor + 1)).0" fi echo "calculated_version=$calculated_version" >> $GITHUB_OUTPUT + echo "calculated_version=$calculated_version" shell: bash outputs: From 3c057bb45b088161b38d0134b52a98f6b59a7a7e Mon Sep 17 00:00:00 2001 From: Vladyslav Avramenko Date: Fri, 8 Aug 2025 12:38:09 +0300 Subject: [PATCH 9/9] FTC-1795 output --- .github/actions/semantic-version/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/semantic-version/action.yml b/.github/actions/semantic-version/action.yml index a018ce1..29da902 100644 --- a/.github/actions/semantic-version/action.yml +++ b/.github/actions/semantic-version/action.yml @@ -21,6 +21,6 @@ runs: shell: bash outputs: - name: + calculated_version: description: Determined semantic version number value: ${{ steps.version.outputs.calculated_version }}