Repository navigation
68 lines (64 loc) · 2.23 KB
/
Copy pathrelease.yaml
File metadata and controls
68 lines (64 loc) · 2.23 KB
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
name: "Release new version"
on:
workflow_dispatch:
inputs:
type:
description: 'Release type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
version:
description: 'Override version (optional)'
required: false
type: string
latest-release:
description: 'Is latest release?'
required: false
default: true
type: boolean
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.bump-version.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.ADMIN_TOKEN || secrets.GITHUB_TOKEN }}
- id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- id: bump-version
run: |
VERSION=${{ inputs.version || steps.semvers.outputs[inputs.type] }}
sed -i -E "s/'[0-9]+.[0-9]+.[0-9]+'/'$VERSION'/g" ext_emconf.php
sed -i -E "s/[0-9]+.[0-9]+.[0-9]+/$VERSION/g" Documentation/Settings.cfg
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- id: autocommit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: https://github.com/hoogi91/spreadsheets/releases/tag/${{ steps.bump-version.outputs.version }}
- run: gh release create ${{ steps.bump-version.outputs.version }} --generate-notes --draft --target=${{ steps.autocommit.outputs.commit_hash || github.sha }} --latest=${{ inputs.latest-release }}
env:
GH_TOKEN: ${{ secrets.ADMIN_TOKEN || secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
environment: 'github'
needs: [ bump-version ]
steps:
- uses: actions/checkout@v6
- run: gh release edit ${{ needs.bump-version.outputs.version }} --draft=false --latest=${{ inputs.latest-release }}
env:
GH_TOKEN: ${{ secrets.ADMIN_TOKEN || secrets.GITHUB_TOKEN }}