From 9c9994bc464137509190d86e0a85334e386a6551 Mon Sep 17 00:00:00 2001 From: Aaron Asuncion Date: Fri, 29 Aug 2025 12:51:54 +0800 Subject: [PATCH 1/4] github-action-auto-version - added auto-version workflow to automate executing of `auto_version` to update updated packages' tag --- .github/workflows/auto-version.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/auto-version.yml diff --git a/.github/workflows/auto-version.yml b/.github/workflows/auto-version.yml new file mode 100644 index 0000000..208a7d3 --- /dev/null +++ b/.github/workflows/auto-version.yml @@ -0,0 +1,41 @@ +name: Auto Version Packages + +on: + push: + branches: + - main + paths: + - '**/*.go' + - '**/go.mod' + - '**/go.sum' + +permissions: + contents: write # Required to create tags and push them + +jobs: + auto-version: + name: "Auto Version Changed Packages" + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for tags + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Run auto_version script + run: | + chmod +x ./auto_version + ./auto_version + + - name: Verify tags were created + run: | + echo "Latest tags created:" + git tag --sort=-version:refname | head -10 From 5521de0f213c2e6e03827aa04124bab5d929d0e5 Mon Sep 17 00:00:00 2001 From: Aaron Asuncion Date: Fri, 29 Aug 2025 14:55:46 +0800 Subject: [PATCH 2/4] github-action-auto-version - added workflow_dispatch to specify the version --- .github/workflows/auto-version.yml | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-version.yml b/.github/workflows/auto-version.yml index 208a7d3..db5a43d 100644 --- a/.github/workflows/auto-version.yml +++ b/.github/workflows/auto-version.yml @@ -8,6 +8,17 @@ on: - '**/*.go' - '**/go.mod' - '**/go.sum' + workflow_dispatch: + inputs: + version_type: + description: 'Version type (patch, minor, major)' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major permissions: contents: write # Required to create tags and push them @@ -33,7 +44,32 @@ jobs: - name: Run auto_version script run: | chmod +x ./auto_version - ./auto_version + + # Determine version type from input or default to patch for automatic triggers + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + version_type="${{ github.event.inputs.version_type }}" + else + version_type="patch" + fi + + echo "Using version type: $version_type" + + # Pass the appropriate flag to auto_version script + case "$version_type" in + "major") + ./auto_version --major + ;; + "minor") + ./auto_version --minor + ;; + "patch") + ./auto_version --patch + ;; + *) + echo "Invalid version type: $version_type" + exit 1 + ;; + esac - name: Verify tags were created run: | From c3684144af75b910cc59dcc2ba8c34bcd15661ae Mon Sep 17 00:00:00 2001 From: Aaron Asuncion Date: Fri, 29 Aug 2025 14:59:44 +0800 Subject: [PATCH 3/4] github-action-auto-version - removed auto workflow trigger event --- .github/workflows/auto-version.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/auto-version.yml b/.github/workflows/auto-version.yml index db5a43d..e276b3a 100644 --- a/.github/workflows/auto-version.yml +++ b/.github/workflows/auto-version.yml @@ -1,13 +1,6 @@ name: Auto Version Packages on: - push: - branches: - - main - paths: - - '**/*.go' - - '**/go.mod' - - '**/go.sum' workflow_dispatch: inputs: version_type: From c8fb52a76d8cba9a92e51fca9844a748b24a2b3d Mon Sep 17 00:00:00 2001 From: Aaron Asuncion Date: Fri, 29 Aug 2025 16:39:31 +0800 Subject: [PATCH 4/4] github-action-auto-version - updated actions/checkout to specific version --- .github/workflows/auto-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-version.yml b/.github/workflows/auto-version.yml index e276b3a..a7f0b6f 100644 --- a/.github/workflows/auto-version.yml +++ b/.github/workflows/auto-version.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: fetch-depth: 0 # Fetch all history for tags token: ${{ secrets.GITHUB_TOKEN }}