From d3949b8713c52f7df8ec03abd44bb96eef8d78d0 Mon Sep 17 00:00:00 2001 From: redatman Date: Sat, 20 Jul 2024 18:48:52 +0800 Subject: [PATCH 1/2] feat: Add .gitattributes file This commit introduces a `.gitattributes` file to standardize text encoding, line endings, and merge/diff strategies for various file types within the project. This ensures consistent code formatting and simplifies collaboration by addressing potential conflicts arising from different editors or platforms. --- .gitattributes | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c80f202 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,20 @@ +# Set the text encoding for all files in the project +* text=auto + +# Set the line endings for all files in the project +* eol=lf +# *.sh text eol=lf +# *.py eol=lf +# *.yaml eol=lf + +# # Set the merge strategy for certain file types +# *.txt merge=union +# *.json merge=union + +# # Set the diff tool for certain file types +# *.txt diff= +# *.json diff= + +# # Set the merge tool for certain file types +# *.txt merge= +# *.json merge= From e1da909975f8ab3afb0b724e2b76da4a1edb541a Mon Sep 17 00:00:00 2001 From: redatman Date: Sat, 20 Jul 2024 18:59:52 +0800 Subject: [PATCH 2/2] feat: Update release workflow to use bump-everywhere This commit updates the release workflow to use the `bump-everywhere` action to automate the release process. This action handles creating release tags, updating package versions, and publishing to GitHub releases. The previous workflow relied on custom scripts to perform these tasks, which was more error-prone and difficult to maintain. --- .github/workflows/create-release.yaml | 105 +++----------------------- 1 file changed, 9 insertions(+), 96 deletions(-) diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index b854488..a262454 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -18,103 +18,16 @@ jobs: # git config --global user.name "github-actions[bot]" # git config --global user.email "github-actions[bot]@users.noreply.github.com" - # - name: Set output - # id: set_output - # run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - # - name: Check output - # id: check_output - # env: - # RELEASE_VERSION: ${{ steps.set_output.outputs.tag }} - # run: | - # echo $RELEASE_VERSION - # echo ${{ steps.set_output.outputs.tag }} - - - name: Auto Generate Next Release Tag - id: generate_release_tag - # You may pin to the exact commit or the version. - # uses: amitsingh-007/next-release-tag@d3025f8b2148fb519af1bcf81b1571d7c6db09df - uses: amitsingh-007/next-release-tag@v6.0.0 + - uses: paulhatch/semantic-version@v5.3.0 + id: generate-version with: - # Github secrets token - github_token: ${{ secrets.ACTION_TOKEN }} - # Prefix added to the generated release tag - tag_prefix: "st4-" - # Template format based in which release tag is generated - # tag_template: "v${{ steps.calc_new_version.outputs.new_version }}" - tag_template: 'yyyy.mm.dd.i' - # Explicitly set the previous release tag - previous_tag: # optional + major_pattern: "(MAJOR)" + minor_pattern: "(MINOR)" + version_format: "st4-${major}.${minor}.${patch}" - name: Create Release - uses: softprops/action-gh-release@v2 + id: create-release + uses: undergroundwires/bump-everywhere@1.4.0 with: - name: Release ${{ steps.generate_release_tag.outputs.next_release_tag }} - tag_name: ${{ steps.generate_release_tag.outputs.next_release_tag }} - token: ${{secrets.ACTION_TOKEN}} - generate_release_notes: true - - # - name: bump-everywhere - # # You may pin to the exact commit or the version. - # # uses: undergroundwires/bump-everywhere@5d9c038bc3ecc5648eadbf49ca6c66c6f67b0cf6 - # uses: undergroundwires/bump-everywhere@1.4.0 - # with: - # # # Repository name with owner to bump & release. For example, undergroundwires/bump-everywhere - # # repository: # optional, default is ${{ github.repository }} - # # # Name of the user who will do the bump commit - # # user: # optional, default is ${{ github.actor }} - # # # Commit message that will be used in the bump commit - # # commit-message: # optional, default is ⬆️ bump everywhere to {{version}} - # # # Personal access token (PAT) used to clone & push to the repository. - # git-token: ${{ secrets.ACTION_TOKEN }} # optional, default is ${{ github.token }} - # # # The type of the GitHub release - # # release-type: # optional, default is release - # # # Personal access token (PAT) used to release to GitHub. - # release-token: ${{ secrets.ACTION_TOKEN }} # optional, default is ${{ github.token }} - - # - name: Debug information - # run: | - # git status - # git log -1 - # git remote -v - # shell: bash - - # - name: Calculate new version - # id: calc_new_version - # run: | - # latest_tag=${{ steps.set_output.outputs.tag }} - # if [[ $latest_tag == "" ]]; then - # new_version="v1.0.0" - # else - # new_version=$(echo $latest_tag | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') - # fi - # echo "New version: $new_version" - # echo "::set-output name=new_version::$new_version" - # shell: bash - - # - name: Create tag - # run: | - # new_version=${{ steps.calc_new_version.outputs.new_version }} - # echo "Creating tag $new_version" - # git tag -a "$new_version" -m "Release $new_version" - # shell: bash - - # - name: Push tag to GitHub - # run: | - # new_version=${{ steps.calc_new_version.outputs.new_version }} - # echo "Pushing tag $new_version" - # git push origin "$new_version" - # shell: bash - - # - name: Create GitHub Release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} - # with: - # tag_name: "${{ steps.calc_new_version.outputs.new_version }}" - # release_name: "Release ${{ steps.calc_new_version.outputs.new_version }}" - # draft: false - # prerelease: false - # # body: | - # # ## Changes - # # - Description of changes in this release. + git-token: ${{ secrets.ACTION_TOKEN }} + release-token: ${{ secrets.ACTION_TOKEN }}