-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.65 KB
/
pre_release_prepare.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
name: Update Version and Create PR
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 1.0.1)'
required: true
permissions:
contents: write
pull-requests: write
jobs:
update-version-and-create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: 'main'
- name: Setup Git
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
- name: Create branches
run: |
git checkout -b "release/${MAJOR_MINOR}.x"
git push origin "release/${MAJOR_MINOR}.x"
git checkout -b "${VERSION}_release"
git push origin "${VERSION}_release"
- name: Update version in file
run: |
sed -i "s/__version__ = ".*"/__version__ = "${VERSION}"/" aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py
git commit -am "Update version to ${VERSION}"
git push origin "${VERSION}_release"
# - name: Create Pull Request
# uses: repo-sync/pull-request@v2
# with:
# source_branch: "${{ github.event.inputs.version }}_release"
# destination_branch: "release/${MAJOR_MINOR}.x"
# github_token: ${{ secrets.GA_ACCESS_KEY }}
# pr_title: "Pre-release: Update version to ${{ github.event.inputs.version }}"
# pr_body: |
# ## Description
# This PR updates the version to ${{ github.event.inputs.version }}.
#
# By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
- name: Create pull request against the release branch
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "Pre-release: Update version to ${VERSION}" \
--body "This PR updates the version to ${VERSION}.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head ${{ github.event.inputs.version }}_release \
--base release/${MAJOR_MINOR}.x