-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.18 KB
/
publish.yaml
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: Publish
on:
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v2
- id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- id: login
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: setup-pack
uses: buildpacks/github-actions/setup-pack@v4.4.0
- id: build-publish
run: |
#!/usr/bin/env bash
set -euo pipefail
pack build ${REPO}:${RELEASE_VERSION} \
--tag ${REPO}:latest \
--buildpack paketo-buildpacks/go \
--builder paketobuildpacks/builder:tiny \
--publish
shell: bash
env:
REPO: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}