forked from mozilla/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.79 KB
/
generate-gh-release-note.yml
File metadata and controls
56 lines (48 loc) · 1.79 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
name: Generate GitHub Release entry
on:
push:
# YYYY-MM-DD or YYYY-MM-DD.integer for times when there are multiple releases in a day
# (Repetition here is safer than a wildcard glob)
tags:
- '20[0-9][0-9]-[01][0-9]-[0-3][0-9]'
- '20[0-9][0-9]-[01][0-9]-[0-3][0-9].[0-9]'
- '20[0-9][0-9]-[01][0-9]-[0-3][0-9].[0-9][0-9]'
- '20[0-9][0-9]-[01][0-9]-[0-3][0-9].[0-9][0-9][0-9]'
jobs:
create-release:
name: Generate GitHub Release entry
runs-on: ubuntu-slim
if: github.repository == 'mozilla/bedrock'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Validate tag format
id: validate
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
# Validate tag matches production format YYYY-MM-DD or YYYY-MM-DD.integer
if [[ $TAG_NAME =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}(\.[0-9]{1,3})?$ ]]; then
echo "Current tag: $TAG_NAME"
echo "valid=true" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
else
echo "Tag does not match production format, skipping release creation"
echo "valid=false" >> $GITHUB_OUTPUT
exit 0
fi
- name: Create GitHub Release
if: steps.validate.outputs.valid == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
CURRENT_TAG="${{ steps.validate.outputs.tag_name }}"
# Create the release with auto-generated notes
gh release create "$CURRENT_TAG" \
--title "Production Release $CURRENT_TAG" \
--generate-notes \
--verify-tag
echo "✅ Successfully created release for $CURRENT_TAG"