forked from sue445/dockerfile-heroku-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (62 loc) · 2.48 KB
/
build.yml
File metadata and controls
71 lines (62 loc) · 2.48 KB
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
name: Build and Push Docker Container
on:
push:
branches:
- 'develop-*'
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
required: false
description: 'Tag to build (e.g., v1.2.3)'
jobs:
build-heroku-cli-container:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Read version from file and set output
id: version
run: |
VERSION=$(cat VERSION)
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to GHCR
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: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}},prefix=int-,match=v(\d.\d.\d)$,event=tag
type=semver,pattern={{version}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
type=semver,pattern={{major}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
type=raw,value=latest,event=branch
type=raw,value=heroku-cli-${{ steps.version.outputs.version }},event=branch
type=raw,value=dev,enable=${{ startsWith(github.ref_name, 'develop-') }}
- name: Build and push Docker images
id: push
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
platforms: linux/amd64
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Heroku CLI https://github.com/heroku/cli/releases/tag/v${{ steps.version.outputs.version }},annotation-index.org.opencontainers.image.version=${{ steps.version.outputs.version }}