From 1fab4198e7a5f37a68e73f7d3577b6d638a006da Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Sat, 5 Oct 2024 17:11:23 +0800 Subject: [PATCH] Added auto-tag.yml --- .github/workflows/auto-tag.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/auto-tag.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..d4aacd3 --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,40 @@ +name: publish to nuget +on: + push: + branches: + - master + - main +jobs: + publish: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: read common.props + id: commonProps + uses: juliangruber/read-file-action@v1 + with: + path: ./dotnet/common.props + + - name: get version + id: getVersion + uses: AsasInnab/regex-action@v1 + with: + regex_pattern: '(?<=>)[^<>]+(?=)' + regex_flags: 'gim' + search_string: '${{ steps.commonProps.outputs.content }}' + + - name: determine if the tag exists + uses: mukunku/tag-exists-action@v1.0.0 + id: checkTag + with: + tag: ${{ steps.getVersion.outputs.first_match }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: add git tag + if: ${{ steps.checkTag.outputs.exists == 'false' }} + uses: tvdias/github-tagger@v0.0.1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.getVersion.outputs.first_match }}