-
Notifications
You must be signed in to change notification settings - Fork 40
64 lines (57 loc) · 1.74 KB
/
Copy pathrelease.yml
File metadata and controls
64 lines (57 loc) · 1.74 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
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: Tag to release (vX.Y.Z)
required: true
type: string
mode:
description: Release mode
required: true
default: dry-run
type: choice
options:
- dry-run
- publish
channels:
description: 'JSON array of channels (example: ["stable","beta"])'
required: false
default: '["stable"]'
type: string
concurrency:
group: release-${{ github.event_name == 'push' && github.ref_name || inputs.tag }}-${{ github.event_name == 'push' && 'publish' || inputs.mode }}
cancel-in-progress: false
permissions:
contents: write
jobs:
detect-channel:
if: github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
channels_json: ${{ steps.detect.outputs.channels_json }}
steps:
- name: Derive channel from tag suffix
id: detect
shell: bash
env:
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-([A-Za-z]+) ]]; then
CHANNEL="${BASH_REMATCH[1]}"
else
CHANNEL="stable"
fi
echo "channels_json=[\"$CHANNEL\"]" >> "$GITHUB_OUTPUT"
release:
needs: [detect-channel]
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/release-foundation.yml
with:
mode: ${{ github.event_name == 'push' && 'publish' || inputs.mode }}
release_tag: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }}
channels_json: ${{ github.event_name == 'push' && needs.detect-channel.outputs.channels_json || inputs.channels }}
secrets: inherit