-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.14 KB
/
Copy pathon-api-release.yml
File metadata and controls
67 lines (58 loc) · 2.14 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
name: on-api-release
on:
release:
types: [ published ]
env:
GITHUB_PUSH_TOKEN: ${{ secrets.INTERSCRIPT_CI_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
permissions:
contents: read
packages: write
jobs:
build-release:
runs-on: ubuntu-latest
# id=68949242 => interscript-ci user
if: ${{ github.event.release.author.id == 68949242 }}
steps:
- uses: actions/checkout@v7
- name: Extract gem version from release body
run: |
RELEASE_BODY="${{github.event.release.body}}"
RELEASE_TAG_NAME="${{github.event.release.tag_name}}"
GEM_VERSION=$(echo "$RELEASE_BODY" | grep -Po '(?<=v)[^;]+')
echo "RELEASE_TAG_NAME=$RELEASE_TAG_NAME" >> ${GITHUB_ENV}
echo "GEM_VERSION=$GEM_VERSION" >> ${GITHUB_ENV}
echo "INTERSCRIPT_GEM_VERSION=$GEM_VERSION" >> ${GITHUB_ENV}
- name: Prepare docker context
working-directory: .github/lambda
run: bash build.sh
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ env.GITHUB_PUSH_TOKEN }}
- name: Build and push Lambda image
uses: docker/build-push-action@v7
with:
context: .github/lambda
file: .github/lambda/Dockerfile
push: true
build-args: |
INTERSCRIPT_GEM_VERSION=${{ env.GEM_VERSION }}
tags: |
ghcr.io/${{ github.repository }}/awslambda-interscript-api:latest
ghcr.io/${{ github.repository }}/awslambda-interscript-api:${{ env.RELEASE_TAG_NAME }}
- name: Dispatch "infrastructure-lambda-api"
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ env.GITHUB_PUSH_TOKEN }}
repository: interscript/infrastructure-lambda-api
event-type: ${{ github.repository }}
client-payload: >-
{
"workflow": "publish-ecr.yml",
"api_tag_name": "${{env.RELEASE_TAG_NAME}}"
}