18
18
enabled : ${{ startsWith(github.ref, 'refs/tags') }}
19
19
20
20
packages :
21
- uses : ./.github/workflows/packages.yml
21
+ permissions :
22
+ id-token : write
23
+ contents : write
24
+ runs-on : ubuntu-latest
25
+ steps :
26
+ - uses : actions/checkout@v4
27
+ - uses : ./.github/actions/packages
22
28
23
29
publish-pypi :
24
30
needs :
46
52
repository-url : https://test.pypi.org/legacy/
47
53
48
54
build-distribution :
49
- uses : ./.github/workflows/build-distribution.yml
55
+ permissions :
56
+ id-token : write
57
+ contents : write
58
+ runs-on : ubuntu-latest
59
+ steps :
60
+ - uses : actions/checkout@v4
61
+ - uses : ./.github/actions/build-distribution
62
+ - name : generate build provenance
63
+ uses : github-early-access/generate-build-provenance@main
64
+ with :
65
+ subject-path : " ${{ github.workspace }}/build/dist/elastic-apm-python-lambda-layer.zip"
50
66
51
67
publish-lambda-layers :
52
68
needs :
63
79
secrets : |
64
80
secret/observability-team/ci/service-account/apm-agent-python access_key_id | AWS_ACCESS_KEY_ID ;
65
81
secret/observability-team/ci/service-account/apm-agent-python secret_access_key | AWS_SECRET_ACCESS_KEY
66
- - uses : actions/download-artifact@v3
82
+ - uses : actions/download-artifact@v4
67
83
with :
68
84
name : build-distribution
69
85
path : ./build
86
102
needs :
87
103
- build-distribution
88
104
runs-on : ubuntu-latest
105
+ permissions :
106
+ id-token : write
107
+ contents : write
89
108
env :
90
109
DOCKER_IMAGE_NAME : docker.elastic.co/observability/apm-agent-python
91
110
steps :
97
116
url : ${{ secrets.VAULT_ADDR }}
98
117
roleId : ${{ secrets.VAULT_ROLE_ID }}
99
118
secretId : ${{ secrets.VAULT_SECRET_ID }}
100
- - uses : actions/download-artifact@v3
119
+ - uses : actions/download-artifact@v4
101
120
with :
102
121
name : build-distribution
103
122
path : ./build
@@ -107,25 +126,30 @@ jobs:
107
126
if [ "${{ startsWith(github.ref, 'refs/tags') }}" == "false" ] ; then
108
127
# for testing purposes
109
128
echo "tag=test" >> "${GITHUB_OUTPUT}"
129
+ echo "latest=test-latest" >> "${GITHUB_OUTPUT}"
110
130
else
111
131
# version without v prefix (e.g. 1.2.3)
112
132
echo "tag=${GITHUB_REF_NAME/v/}" >> "${GITHUB_OUTPUT}"
133
+ echo "latest=latest" >> "${GITHUB_OUTPUT}"
113
134
fi
114
- - name : Docker build
115
- run : >-
116
- docker build
117
- -t ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
118
- --build-arg AGENT_DIR=./build/dist/package/python
119
- .
120
- - name : Docker retag
121
- run : >-
122
- docker tag
123
- ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
124
- ${{ env.DOCKER_IMAGE_NAME }}:latest
125
- - name : Docker push
126
- if : startsWith(github.ref, 'refs/tags')
127
- run : |-
128
- docker push --all-tags ${{ env.DOCKER_IMAGE_NAME }}
135
+ - name : Build and push image
136
+ id : push
137
+ uses : docker/build-push-action@v5.3.0
138
+ with :
139
+ context : .
140
+ push : true
141
+ tags : |
142
+ ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}
143
+ ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.latest }}
144
+ build-args : |
145
+ AGENT_DIR=./build/dist/package/python
146
+
147
+ - name : Attest image
148
+ uses : github-early-access/generate-build-provenance@main
149
+ with :
150
+ subject-name : " ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.setup-docker.outputs.tag }}"
151
+ subject-digest : ${{ steps.push.outputs.digest }}
152
+ push-to-registry : false
129
153
130
154
github-draft :
131
155
permissions :
0 commit comments