forked from grafana/lambda-promtail
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.65 KB
/
release.yml
File metadata and controls
49 lines (41 loc) · 1.65 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
name: Release
on:
push:
tags:
- 'v*.*.*'
env:
REPO_NAME: ${{ vars.DOCKER_REPO_PREFIX}}/${{ github.event.repository.name }} # devops/hello-world
FULL_IMAGE_NAME: ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPO_PREFIX}}/${{ github.event.repository.name }} # 1234.eu-west-2.ecr.amazonaws.com/devops/hello-world
TAG_NAME: ${{ github.ref_name }} # v1.2.34
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: eu-west-2
role-to-assume: ${{ vars.ECR_ROLE }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076
- name: Ensure repo
run: aws ecr describe-repositories --repository-names ${{ env.REPO_NAME }} || aws ecr create-repository --repository-name ${{ env.REPO_NAME }}
- name: Build and push Docker image for Lambda
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.REPO_NAME }}
IMAGE_TAG: ${{ env.TAG_NAME }}
run: |
docker buildx build --platform linux/amd64 \
--provenance=false --progress=plain \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
-f Dockerfile \
--push .