|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - main
|
7 |
| - |
| 7 | + |
8 | 8 | permissions:
|
9 | 9 | contents: write # we need this to be able to push tags
|
| 10 | + pull-requests: read |
10 | 11 |
|
11 | 12 | jobs:
|
12 | 13 | release_tag:
|
13 |
| - name: Release version |
14 |
| - runs-on: ubuntu-24.04 |
15 |
| - steps: |
16 |
| - - name: Checkout code |
17 |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
18 |
| - with: |
19 |
| - ssh-key: ${{ secrets.PUSH_KEY }} |
20 |
| - fetch-tags: true |
21 |
| - fetch-depth: 0 |
22 |
| - submodules: recursive |
23 |
| - |
24 |
| - - name: Install Task |
25 |
| - uses: arduino/setup-task@v2 |
26 |
| - with: |
27 |
| - version: 3.42.1 |
28 |
| - |
29 |
| - - name: Read and validate VERSION |
30 |
| - id: version |
31 |
| - run: | |
32 |
| - VERSION=$(task version) |
33 |
| - if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then |
34 |
| - echo "Invalid version format: $VERSION" |
35 |
| - exit 1 |
36 |
| - fi |
37 |
| - echo "New version: $VERSION" |
38 |
| - echo "version=$VERSION" >> $GITHUB_ENV |
39 |
| -
|
40 |
| - - name: Skip release if version is a dev version |
41 |
| - if: contains(env.version, '-dev') |
42 |
| - run: | |
43 |
| - echo "Skipping development version release: ${{ env.version }}" |
44 |
| - echo "SKIP=true" >> $GITHUB_ENV |
45 |
| - exit 0 |
46 |
| - |
47 |
| - - name: Check if VERSION is already tagged |
48 |
| - id: check_tag |
49 |
| - run: | |
50 |
| - if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then |
51 |
| - echo "Tag ${{ env.version }} already exists. Skipping release." |
52 |
| - echo "SKIP=true" >> $GITHUB_ENV |
53 |
| - exit 0 |
54 |
| - fi |
55 |
| - echo "Tag ${{ env.version }} doesn't exists. Proceeding with release." |
56 |
| -
|
57 |
| - - name: Create Git tag |
58 |
| - if: ${{ env.SKIP != 'true' }} |
59 |
| - run: | |
60 |
| - AUTHOR_NAME=$(git log -1 --pretty=format:'%an') |
61 |
| - AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae') |
62 |
| - echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>" |
63 |
| -
|
64 |
| - echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV |
65 |
| - echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV |
66 |
| -
|
67 |
| - git config user.name "$AUTHOR_NAME" |
68 |
| - git config user.email "$AUTHOR_EMAIL" |
69 |
| -
|
70 |
| - git tag -a "${{ env.version }}" -m "Release ${{ env.version }}" |
71 |
| - git push origin "${{ env.version }}" |
72 |
| -
|
73 |
| - - name: Build Changelog |
74 |
| - id: github_release |
75 |
| - uses: mikepenz/release-changelog-builder-action@e92187bd633e680ebfdd15961a7c30b2d097e7ad # v5 |
76 |
| - with: |
77 |
| - mode: "PR" |
78 |
| - configurationJson: | |
79 |
| - { |
80 |
| - "template": "#{{CHANGELOG}}", |
81 |
| - "pr_template": "- #{{TITLE}}: ##{{NUMBER}}", |
82 |
| - "categories": [ |
83 |
| - { |
84 |
| - "title": "## Feature", |
85 |
| - "labels": ["feat", "feature"] |
86 |
| - }, |
87 |
| - { |
88 |
| - "title": "## Fix", |
89 |
| - "labels": ["fix", "bug"] |
90 |
| - }, |
91 |
| - { |
92 |
| - "title": "## Other", |
93 |
| - "labels": [] |
94 |
| - } |
95 |
| - ], |
96 |
| - "label_extractor": [ |
97 |
| - { |
98 |
| - "pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)", |
99 |
| - "on_property": "title", |
100 |
| - "target": "$1" |
101 |
| - } |
102 |
| - ] |
103 |
| - } |
104 |
| - env: |
105 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
106 |
| - |
107 |
| - - name: Create GitHub release |
108 |
| - if: ${{ env.SKIP != 'true' }} |
109 |
| - uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2 |
110 |
| - with: |
111 |
| - tag_name: ${{ env.version }} |
112 |
| - name: Release ${{ env.version }} |
113 |
| - body: "Automated release for version ${{ env.version }}" |
114 |
| - draft: false |
115 |
| - prerelease: false |
116 |
| - env: |
117 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
118 |
| - |
119 |
| - - name: Push dev VERSION |
120 |
| - if: ${{ env.SKIP != 'true' }} |
121 |
| - run: | |
122 |
| - task release:set-version --verbose -- "${{ env.version }}-dev" |
123 |
| - git config user.name "${{ env.AUTHOR_NAME }}" |
124 |
| - git config user.email "${{ env.AUTHOR_EMAIL }}" |
125 |
| - git add VERSION |
126 |
| - git commit -m "Update VERSION to ${{ env.version }}-dev" |
127 |
| - git push origin main |
| 14 | + uses: openmcp-project/build/.github/workflows/release.lib.yaml@main |
| 15 | + secrets: inherit |
0 commit comments