forked from LayerLens/stratix-python
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.66 KB
/
create-tag.yaml
File metadata and controls
78 lines (67 loc) · 2.66 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
69
70
71
72
73
74
75
76
77
78
# This workflow creates and pushes a release tag using the push-release-tag.sh script.
# It can be triggered manually and will prompt for confirmation before creating the tag.
name: Create Release Tag
on:
workflow_dispatch:
inputs:
dry_run:
description: "Run in dry-run mode (show what would be done without actually creating/pushing the tag)"
required: false
type: boolean
default: true
confirm_release:
description: "Type 'YES' to confirm you want to create and push the release tag"
required: true
type: string
jobs:
check-branch:
runs-on: ubuntu-latest
environment: production
steps:
- name: Check if running on release branch
run: |
if [ "${{ github.ref }}" != "refs/heads/release" ]; then
echo "Error: This workflow can only be run from the 'release' branch."
echo "Current branch: ${{ github.ref }}"
echo "Please switch to the 'release' branch and try again."
exit 1
fi
echo "Running on release branch - proceeding with workflow."
create-release-tag:
runs-on: ubuntu-latest
needs: check-branch
environment: production
if: github.ref == 'refs/heads/release'
permissions:
contents: write # Required to create and push tags
steps:
- name: Validate confirmation
if: github.event.inputs.confirm_release != 'YES' && github.event.inputs.dry_run != 'true'
run: |
echo "Error: You must type 'YES' in the confirm_release input to proceed with creating a release tag."
echo "Received: '${{ github.event.inputs.confirm_release }}'"
exit 1
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history and tags
- name: Make scripts executable
run: |
chmod +x scripts/push_release_tag.sh
chmod +x scripts/get_version.sh
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Run push-release-tag script (dry-run)
if: github.event.inputs.dry_run == 'true'
run: |
echo "Running in dry-run mode..."
make push-release-tag DRY_RUN=--dry-run
- name: Run push-release-tag script
if: github.event.inputs.dry_run != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Creating and pushing release tag..."
# Override the interactive confirmation since we already confirmed via workflow input
echo "YES" | make push-release-tag