forked from web3infra-foundation/mega
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (61 loc) · 1.92 KB
/
mega-dev-image-deploy.yml
File metadata and controls
70 lines (61 loc) · 1.92 KB
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
name: Mega Dev Image deploy
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/mega-dev-image-deploy.yml"
- "docker/dev-image/**"
- "orion/**"
- "scorpio/**"
- "ceres/**"
- "jupiter/**"
- "common/**"
- "context/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
actions: write
jobs:
build-and-push:
if: ${{ github.repository == 'web3infra-foundation/mega' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build, tag, and push dev image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: m8q5m4u3
REPOSITORY: mega
IMAGE_TAG: mega-dev-0.1.0-pre-release
run: |
set -euo pipefail
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
IMAGE_BASE="$REGISTRY/$REGISTRY_ALIAS/$REPOSITORY"
docker buildx build \
--platform linux/amd64 \
--target runtime \
--cache-from type=gha,scope=mega-dev-image \
--cache-to type=gha,mode=max,scope=mega-dev-image \
-t "$IMAGE_BASE:$IMAGE_TAG" \
-t "$IMAGE_BASE:$IMAGE_TAG-$TIMESTAMP" \
-f docker/dev-image/Dockerfile \
--push .