-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.12 KB
/
release-candidate.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
name: Release to Staging
on:
# workflow_dispatch:
# inputs:
# version:
# description: 'New release candidate version (e.g. rc-1.0.0)'
# required: true
workflow_call:
inputs:
version:
description: 'New release candidate version (e.g. rc-1.0.0)'
required: true
type: string
jobs:
prepare_release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Switch to staging branch and rebase from dev
run: |
git checkout staging
git pull origin staging
git rebase origin/dev || (git rebase --abort && echo "Rebase failed, manual resolution required" && exit 1)
git push origin staging --force
- name: Generate release tag
run: |
NEW_TAG="rc-${{ github.event.inputs.version }}"
git tag $NEW_TAG
git push origin $NEW_TAG
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: Fetch all tags
run: git fetch --tags
- name: Generate changelog
run: |
LAST_TAG=$(git describe --tags --match "rc-*" --abbrev=0)
echo "## Changelog for ${{ github.event.inputs.version }}" > CHANGELOG.md
echo "Generating changelog from tag: $LAST_TAG"
git log $LAST_TAG..HEAD --pretty=format:"- %s (%an, %ad)" --date=short >> CHANGELOG.md
cat CHANGELOG.md
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.NEW_TAG }}
name: Release Candidate ${{ github.event.inputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: true
trigger_deployment:
needs: prepare_release
uses: ./.github/workflows/deploy-v3.yml
secrets: inherit
with:
branch_name: staging
environment_name: staging