forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (112 loc) · 4.56 KB
/
release-airbyte-os.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Release Open Source Airbyte
concurrency: release-airbyte
on:
workflow_dispatch:
inputs:
partToBump:
description: "Please choose the type of version upgrade : major|minor|patch"
required: true
default: "patch"
jobs:
# In case of self-hosted EC2 errors, remove this block.
start-release-airbyte-runner:
name: "Release Airbyte: Start EC2 Runner"
timeout-minutes: 10
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v2
- name: Start AWS Runner
id: start-ec2-runner
uses: ./.github/actions/start-aws-runner
with:
aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
releaseAirbyte:
# In case of self-hosted EC2 errors, removed the `needs` line and switch back to running on ubuntu-latest.
needs: start-release-airbyte-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-release-airbyte-runner.outputs.label }} # run the job on the newly created runner
environment: more-secrets
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: "17"
- uses: actions/setup-node@v1
with:
node-version: "16.13.0"
# necessary to install pip
- uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Save Old Version
id: old_version
run: |
echo ::set-output name=OLD_VERSION::$(grep -w VERSION .env | cut -d"=" -f2)
- name: Release Airbyte
id: release_airbyte
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PART_TO_BUMP: ${{ github.event.inputs.partToBump }}
CLOUDREPO_USER: ${{ secrets.CLOUDREPO_USER }}
CLOUDREPO_PASSWORD: ${{ secrets.CLOUDREPO_PASSWORD }}
run: |
./tools/bin/release_version.sh
- name: Save New Version
id: new_version
run: |
echo ::set-output name=NEW_VERSION::$(grep -w VERSION .env | cut -d"=" -f2)
- name: Get PR Body
id: pr_body
env:
PREV_VERSION: ${{ steps.old_version.outputs.OLD_VERSION }}
run: |
chmod +x tools/bin/pr_body.sh
body=$(./tools/bin/pr_body.sh)
body="${body//$'\n'/'%0A'}"
echo ::set-output name=PR_BODY::$body
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.SLASH_COMMAND_PAT }}
branch: bump-version
branch-suffix: random
delete-branch: true
title: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }}
body: ${{ steps.pr_body.outputs.PR_BODY }}
commit-message: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }}
- name: PR Details
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
# In case of self-hosted EC2 errors, remove this block.
stop-release-airbyte-runner:
name: "Release Airbyte: Stop EC2 Runner"
timeout-minutes: 10
needs:
- start-release-airbyte-runner # required to get output from the start-runner job
- releaseAirbyte # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.3.0
with:
mode: stop
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
label: ${{ needs.start-release-airbyte-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-release-airbyte-runner.outputs.ec2-instance-id }}