-
Notifications
You must be signed in to change notification settings - Fork 155
107 lines (91 loc) · 3.04 KB
/
Copy pathrelease-worker.yml
File metadata and controls
107 lines (91 loc) · 3.04 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
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
name: Build and release Worker
on:
release:
types: [created]
permissions:
id-token: write
contents: read
jobs:
build_and_release_worker:
if: startsWith(github.ref, 'refs/tags/worker-')
environment: Release
name: build (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
arch: amd64
runner: ubuntu-latest
- platform: linux/arm64
arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_GITHUB }}
aws-region: us-east-1
- name: Log in to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
with:
registry-type: public
mask-password: "true"
- name: Set version
id: set-version
run: |
echo "TAG_NAME=${GITHUB_REF_NAME#worker-}" >> $GITHUB_OUTPUT
- name: Build and push container image to Amazon ECR
uses: docker/build-push-action@v5
with:
file: ./docker/Dockerfile.worker
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/n4e0e1y0/beta9-worker:${{ steps.set-version.outputs.TAG_NAME }}-${{ matrix.arch }}
target: final
platforms: ${{ matrix.platform }}
build-args: |
CEDANA_TOKEN=${{ secrets.CEDANA_TOKEN }}
CEDANA_BASE_URL=${{ secrets.CEDANA_BASE_URL }}
publish_worker_manifest:
if: startsWith(github.ref, 'refs/tags/worker-')
needs: build_and_release_worker
environment: Release
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_GITHUB }}
aws-region: us-east-1
- name: Log in to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
with:
registry-type: public
mask-password: "true"
- name: Set version
id: set-version
run: |
echo "TAG_NAME=${GITHUB_REF_NAME#worker-}" >> $GITHUB_OUTPUT
- name: Publish multi-platform image manifests
env:
IMAGE: ${{ steps.login-ecr.outputs.registry }}/n4e0e1y0/beta9-worker
TAG_NAME: ${{ steps.set-version.outputs.TAG_NAME }}
run: |
docker buildx imagetools create \
--tag "${IMAGE}:${TAG_NAME}" \
"${IMAGE}:${TAG_NAME}-amd64" \
"${IMAGE}:${TAG_NAME}-arm64"
docker buildx imagetools create \
--tag "${IMAGE}:latest" \
"${IMAGE}:${TAG_NAME}-amd64" \
"${IMAGE}:${TAG_NAME}-arm64"