generated from communitiesuk/funding-service-design-TEMPLATE
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.41 KB
/
package.yml
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
name: Use Paketo to package and build python application
permissions:
packages: write
on:
workflow_call:
inputs:
version_to_build:
type: string
required: true
env:
REGISTRY: ghcr.io
DOCKER_IMAGE: funding-service-design-authenticator
jobs:
paketo_build:
runs-on: ubuntu-latest
name: Packaging and building the application
steps:
- uses: buildpacks/github-actions/setup-pack@v5.0.0
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish app image
run: "pack build ${{ env.DOCKER_IMAGE }} --builder paketobuildpacks/builder:base"
- name: Push image
run: |
IMAGE_ID=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=${{ inputs.version_to_build }}
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag ${{ env.DOCKER_IMAGE }} $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION