-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2.5 KB
/
update-project.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Create new Tag
concurrency:
group: ${{github.repository}}-update-tag
cancel-in-progress: false
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
tag:
description: 'Tag to be created (when empty, it will be automatically computed)'
required: false
type: string
python:
description: 'Update pyproject.toml automatically'
required: false
type: boolean
jobs:
create-new-tag:
runs-on: ubuntu-latest
#if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.REPO_PAT }}
fetch-depth: 0
- name: 'Validate semver'
if: ${{ inputs.tag != '' }}
run: |
local regex='^([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?)?$'
if [[ "$version" =~ $regex ]]; then
echo "${{ inputs.tag }} is a valid SemVer."
echo "NEWTAG=${{ inputs.tag }}" >> $GITHUB_ENV
else
echo "${{ inputs.tag }} is NOT a valid SemVer."
exit 1
fi
- name: 'Get Previous tag'
id: previoustag
if: ${{ inputs.tag == '' }}
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.0 # Optional fallback tag to use when no tag can be found
- name: 'Get next minor version'
id: semvers
if: ${{ inputs.tag == '' }}
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: 'Set tag'
if: ${{ inputs.tag == '' }}
run: |
echo "NEWTAG=${{ steps.semvers.outputs.patch }}" >> $GITHUB_ENV
- name: Commit tag changes
run: |
git config --global user.name 'Bot'
git config --global user.email '[email protected]'
git commit -am "Automated tag changes [dependabot skip]" || echo "No changes to commit"
git push
- name: Test
run: echo $NEWTAG
# - name: Create New Tag
# run: |
# git tag -a "v${{ env.new_version }}" -m "Release v${{ env.new_version }}"
# git push origin "v${{ env.new_version }}"
# - name: Publish Release
# uses: actions/create-release@v1
# with:
# tag_name: "v${{ env.new_version }}"
# release_name: "Release v${{ env.new_version }}"