forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (93 loc) · 3.69 KB
/
choose_rc_commit.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# This workflow will choose a commit to be the basis of a release candidate
## and push a new tagged commit for that RC.
# To learn more about GitHub Actions in Apache Beam check the CI.md
name: Choose RC Commit
on:
workflow_dispatch:
inputs:
RELEASE:
description: Beam version of current release (e.g. 2.XX.0)
required: true
RC:
description: Integer RC version for the release (e.g. 3 for RC3)
required: true
COMMIT:
description: Selected commit to create the release (should be full commit sha)
required: true
PUSH_TAG:
description: Push tag (yes/no)
required: false
default: no
OVERWRITE:
description: Overwrite RC Tag (yes/no)
required: false
default: no
DEBUG:
description: Debug enabled (yes/no)
required: false
default: no
jobs:
choose_rc_commit:
runs-on: [self-hosted, ubuntu-20.04]
env:
RC_TAG: v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}
SCRIPT_DIR: ./release/src/main/scripts
DEBUG: ""
steps:
- name: Check out code
uses: actions/checkout@v3
with:
ref: release-${{ github.event.inputs.RELEASE }}
- name: Set git config
run: |
git config user.name $GITHUB_ACTOR
git config user.email actions@"$RUNNER_NAME".local
- name: Enable debugging
if: ${{github.event.inputs.DEBUG == 'yes'}}
run: |
echo "DEBUG=--debug" >> $GITHUB_ENV
- name: Set version and commit
run: |
bash "${SCRIPT_DIR}/set_version.sh" "${{ github.event.inputs.RELEASE }}" --release \
--git-add $DEBUG
# suppress warning about detached HEAD: we want it detached so we do not edit the branch
git checkout --quiet ${{ github.event.inputs.COMMIT }}
git commit -m "Set version for ${{ github.event.inputs.RELEASE }} RC${{ github.event.inputs.RC }}"
- name: Overwrite tag
run: |
if git rev-parse "$RC_TAG" >/dev/null 2>&1; then
if [[ "${{ github.event.inputs.OVERWRITE }}" == yes ]]; then
git push origin ":refs/tags/$RC_TAG"
else
echo "Tag $RC_TAG already exists. Either delete it manually or run with --overwrite. Do not overwrite if an RC has been built and shared!"
exit 1
fi
fi
- name: Tag for Go SDK
# Go Modules defined in sub directories need to have a prefixed tag
# in order to get the matching version.
# See BEAM-13119 for context.
run: git tag -a "sdks/$RC_TAG" -m "Go SDK $RC_TAG" HEAD
- name: Primary tag for the repo
run: git tag -a -m "$RC_TAG" "$RC_TAG" HEAD
- name: Push tag
if: ${{github.event.inputs.PUSH_TAG == 'yes'}}
run: |
git push --follow-tags origin "sdks/$RC_TAG"
git push --follow-tags origin "$RC_TAG"