forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.24 KB
/
build.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
name: "Docker Images"
on:
push:
branches:
- master
workflow_call:
outputs:
tag_hash:
description: "The commit hash used to tag the Docker image"
value: ${{ jobs.build-image.outputs.tag_hash }}
env:
AWS_REGION: eu-west-1
jobs:
build-image:
name: Build, Tag and Upload
runs-on: ubuntu-latest
permissions:
checks: write
actions: write
contents: write
packages: read
issues: read
pull-requests: write
id-token: write
env:
SUPERSET_REPOSITORY_URI: "289222877357.dkr.ecr.eu-west-1.amazonaws.com/webgains/superset"
BUILD_ROLE_ARN: arn:aws:iam::289222877357:role/github-superset-access
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create dist directory
run: mkdir dist
- name: Compute labels
id: compute_labels
run: |
TAG_HASH="$(echo $GITHUB_SHA | head -c 8)"
TAG_NAME="$(echo $GITHUB_REF | sed -E -e 's:refs/pull/([0-9]+)/merge:pr.\1:' -e 's:refs/heads/::' -e 's:tag/v?([.0-9]+):v\1:' -e 's:/:.:')"
echo "TAG_HASH=$TAG_HASH" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
if [ $TAG_NAME = "main" ]; then echo "LATEST_TAG=$SUPERSET_REPOSITORY_URI:latest" >> $GITHUB_ENV; fi
echo "tag_hash=$TAG_HASH" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.BUILD_ROLE_ARN }}
role-session-name: build-${{ github.run_id }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_HASH }}
${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_NAME }}
${{ env.LATEST_TAG }}
target: webgains
outputs:
tag_hash: ${{ steps.compute_labels.outputs.tag_hash }}