-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (57 loc) · 1.76 KB
/
Copy pathautomatic-release.yaml
File metadata and controls
63 lines (57 loc) · 1.76 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
# This is a basic workflow to help you get started with Actions
name: Automatic Release
# Controls when the workflow will run
on:
pull_request:
branches:
- main
types:
- closed
# Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
# Deny all GITHUB_TOKEN scopes by default; jobs opt into the minimum they need.
permissions: {}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
get-labels:
if: ${{github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/')}}
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
labels: ${{ steps.match-label.outputs.match }}
steps:
- uses: actions/checkout@v7
- id: match-label
shell: bash
run: |
chmod +x .github/workflows/get-label.sh
.github/workflows/get-label.sh -n 'major, minor, patch' -l '${{ join(github.event.pull_request.labels.*.name, ', ') }}'
echo "::set-output name=match::$(cat match.txt)"
semver-version:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- get-labels
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: zwaldowski/semver-release-action@v6
id: version
with:
bump: ${{ needs.get-labels.outputs.labels }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prefix: 'v'
release:
permissions:
contents: write
packages: write
pull-requests: write
needs:
- semver-version
uses: ./.github/workflows/release.yaml
with:
version: '${{ needs.semver-version.outputs.version }}'
secrets: inherit