-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.03 KB
/
release-workflow.yml
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
77
name: Trigger release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
type: string
required: true
permissions:
packages: write
contents: write
pages: write
id-token: write
env:
VERSION_PATTERN: '^\d+\.\d+\.\d+(-alpha\d\d|-rc\d\d)?$'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if version is valid
uses: kaisugi/action-regex-match@v1.0.1
id: regex-match
with:
text: ${{ inputs.version }}
regex: ${{ env.VERSION_PATTERN }}
- name: Version does not match the given pattern
if: steps.regex-match.outputs.match == ''
run: exit 1
- name: Update gradle.properties
run: sed -i "s/^version=.*/version=${{ inputs.version }}/" gradle.properties
- name: Update Writerside variable
run: sed -i 's/\(<var name="kotlinmailer_version" value="\)[^"]*\("\/>\)/\1${{ inputs.version }}\2/' docs/Writerside/v.list
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -a -m "chore: Update config files to ${{ inputs.version }}"
- name: Tag the commit
run: git tag v${{ inputs.version }}
- name: Push changes
run: |
git push origin
git push origin tag v${{ inputs.version }}
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
prerelease: ${{ contains(inputs.version, '-') }}
call-docs:
needs: release
if: ${{ !contains(inputs.version, '-') }}
uses: ./.github/workflows/docs-workflow.yml
with:
version: ${{ inputs.version }}
call-maven-publish:
needs: release
uses: ./.github/workflows/maven-publish-workflow.yml
with:
version: ${{ inputs.version }}
secrets: inherit