forked from pivotal-cf/rabbit-example-app
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (78 loc) · 2.61 KB
/
build-using-cnb-buildpack.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: "Build using cnb buildpack"
permissions:
packages: write
on:
push:
branches:
- '*'
tags:
- "v?[0-9]+.[0-9]+.[0-9]+*"
env:
CNB_IMAGE_NAME: rabbit-cnb-app
SERVICE_NAME: 'rabbit'
SERVICE_IMAGE: "rabbitmq:3-management"
SERVICE_HEALTH_CMD: "rabbitmqctl node_health_check"
SERVICE_PORT: 5672
SERVICE_ADMIN_PORT: 15672
SERVICE_USERNAME: '22032e25-4aba-417f-a394-8bbd78d920cd'
SERVICE_PASSWORD: 'StbQ4EovUpwQjD0cT1Hr7PKBG'
SERVICE_HOST: "dynamically_generated"
DATABASE_NAME: my-rabbit-db-sample
DEBUG: 0
jobs:
package-app:
name: "Package ${{ github.repository }} as CNB app"
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Default: 1
fetch-depth: 1
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Setup pack for ${{ github.repository }}
uses: buildpacks/github-actions/[email protected]
-
name: Packaging app from ${{ github.repository }} pushed by ${{ github.actor }}
shell: bash
run: |
echo "Pack Build ${{env.CNB_IMAGE_NAME}} (${{github.repository}})"
pack build ${{env.CNB_IMAGE_NAME}}
echo "Pack Inspect ${{env.CNB_IMAGE_NAME}} (${{github.repository}})"
pack inspect ${{env.CNB_IMAGE_NAME}}
-
name: Testing app
shell: bash
run: |
source ./setup-prerequisite.sh
./run-tests.sh
-
name: Tag version ${{github.ref_name}}
if: github.ref_type == 'tag'
run: |
docker tag ${{env.CNB_IMAGE_NAME}}:latest ghcr.io/${{ github.repository }}:${{github.ref_name}}
-
name: Tag with common data
run: |
docker tag ${{env.CNB_IMAGE_NAME}}:latest ghcr.io/${{ github.repository }}:latest
docker tag ${{env.CNB_IMAGE_NAME}}:latest ghcr.io/${{ github.repository }}:${{github.sha}}
echo "cleanup built image"
docker image rm ${{env.CNB_IMAGE_NAME}}:latest
echo "dump existing images"
docker images
-
name: Publish ghcr.io/${{ github.repository }}
run: |
echo "publish all tags"
docker push --all-tags ghcr.io/${{ github.repository }}