-
Notifications
You must be signed in to change notification settings - Fork 32
53 lines (45 loc) · 1.27 KB
/
build.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
name: Image
on:
push:
branches: [ main ]
tags: [ '*' ]
jobs:
register:
name: Package, Publish, and Register
runs-on:
- ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v4
- name: Set tag var
id: tag
shell: bash
run: |
#!/usr/bin/env bash
set -euo pipefail
TYPE=$(echo ${GITHUB_REF} | cut -d'/' -f2)
REF=$(echo ${GITHUB_REF} | cut -d'/' -f3)
SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)
TAG=$REF-${SHA7}
if [ "${TYPE}" == "main" ] && [ "${TYPE}" == "tags" ]; then
TAG=$REF
fi
echo ::set-output name=tag::$TAG
- uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- id: setup-pack
uses: buildpacks/github-actions/[email protected]
- id: package
run: |
#!/usr/bin/env bash
set -euo pipefail
NAME=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f2)
PACKAGE="${REPO}/${NAME}"
TAG=${{ steps.tag.outputs.tag }}
pack build --builder paketobuildpacks/builder:tiny --publish ${PACKAGE}:${TAG}
shell: bash
env:
REPO: docker.io/${{ secrets.DOCKER_USERNAME }}