forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (109 loc) · 4.74 KB
/
airbyte-ci-release.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
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Connector Ops CI - Airbyte CI Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
paths:
- "airbyte-ci/connectors/pipelines/**"
workflow_dispatch:
env:
DEV_GCS_BUCKET_NAME: dev-airbyte-cloud-connector-metadata-service
PROD_GCS_BUCKET_NAME: prod-airbyte-cloud-connector-metadata-service
BINARY_FILE_NAME: airbyte-ci
jobs:
build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos"]
steps:
- name: Checkout Airbyte
id: checkout_airbyte
uses: actions/checkout@v3
with:
ref: ${{ github.sha }} # This is required to make sure that the same commit is checked out on all runners
- name: Get short SHA
id: get_short_sha
uses: benjlevesque/short-sha@v2.2
- name: Install Python
id: install_python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
id: install_poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
- name: Install Dependencies
id: install_dependencies
working-directory: airbyte-ci/connectors/pipelines/
run: poetry install --with dev
- name: Build release
id: build_release
working-directory: airbyte-ci/connectors/pipelines/
run: poetry run poe build-release-binary ${{ env.BINARY_FILE_NAME }}
- uses: actions/upload-artifact@v4
with:
name: airbyte-ci-${{ matrix.os }}-${{ steps.get_short_sha.outputs.sha }}
path: airbyte-ci/connectors/pipelines/dist/${{ env.BINARY_FILE_NAME }}
- name: Authenticate to Google Cloud Dev
id: auth_dev
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.METADATA_SERVICE_DEV_GCS_CREDENTIALS }}"
- name: Upload pre-release to GCS dev bucket
id: upload_pre_release_to_gcs
if: github.ref != 'refs/heads/master'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: airbyte-ci/connectors/pipelines/dist/${{ env.BINARY_FILE_NAME }}
destination: ${{ env.DEV_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/${{ steps.get_short_sha.outputs.sha }}
headers: |-
cache-control:public, max-age=10
- name: Print pre-release public url
id: print_pre_release_public_url
run: |
echo "https://storage.googleapis.com/${{ env.DEV_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/${{ steps.get_short_sha.outputs.sha }}/${{ env.BINARY_FILE_NAME }}"
# if master, upload per version and latest to prod bucket
- name: Set version from poetry version --short
id: set_version
if: github.ref == 'refs/heads/master'
working-directory: airbyte-ci/connectors/pipelines/
run: |
echo "version=$(poetry version --short)" >> $GITHUB_OUTPUT
- name: Authenticate to Google Cloud Prod
id: auth_prod
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}"
- name: Upload version release to GCS prod bucket
id: upload_version_release_to_gcs
if: github.ref == 'refs/heads/master'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: airbyte-ci/connectors/pipelines/dist/${{ env.BINARY_FILE_NAME }}
destination: ${{ env.PROD_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/${{ steps.set_version.outputs.version }}
headers: |-
cache-control:public, max-age=10
- name: Print release version public url
id: print_version_release_public_url
if: github.ref == 'refs/heads/master'
run: |
echo "https://storage.googleapis.com/${{ env.PROD_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/${{ steps.set_version.outputs.version }}/${{ env.BINARY_FILE_NAME }}"
- name: Upload latest release to GCS prod bucket
id: upload_latest_release_to_gcs
if: github.ref == 'refs/heads/master'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: airbyte-ci/connectors/pipelines/dist/${{ env.BINARY_FILE_NAME }}
destination: ${{ env.PROD_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/latest
headers: |-
cache-control:public, max-age=10
- name: Print latest release public url
id: print_latest_release_public_url
if: github.ref == 'refs/heads/master'
run: |
echo "https://storage.googleapis.com/${{ env.PROD_GCS_BUCKET_NAME }}/airbyte-ci/releases/${{ matrix.os }}/latest/${{ env.BINARY_FILE_NAME }}"