-
Notifications
You must be signed in to change notification settings - Fork 7
39 lines (32 loc) · 1.24 KB
/
dotnet6x-lambda.yaml
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
name: dotnet6x
on:
push:
branches: [ master ]
paths:
- 'dotnet6x-lambda/**'
- .github/workflows/dotnet6x-lambda.yaml
env:
IMAGE_NAME: dotnet6x-lambda
jobs:
build-and-publish-latest:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # Running this job only for master branch
steps:
- uses: actions/checkout@v2
- name: Build image
run: |
BASE_VERSION=$(cat ${IMAGE_NAME}/version)
NODE_VERSION=$(cat ${IMAGE_NAME}/node)
docker build --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --build-arg BASE_VERSION=${BASE_VERSION} --build-arg NODE_VERSION=${NODE_VERSION} ${IMAGE_NAME}/
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
BASE_VERSION=$(cat ${IMAGE_NAME}/version)
echo "pushing ${IMAGE_NAME} version ${BASE_VERSION}"
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker tag $IMAGE_NAME $IMAGE_ID:${BASE_VERSION}
docker push $IMAGE_ID:latest
docker push $IMAGE_ID:${BASE_VERSION}