Skip to content

Commit 62c257e

Browse files
author
Jonathan Grütter
committed
added build pipeline
1 parent 5f66f3b commit 62c257e

File tree

1 file changed

+60
-18
lines changed

1 file changed

+60
-18
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,71 @@
1-
name: build
1+
name: Build and Push Docker Container
22

33
on:
44
push:
55
branches:
6-
- master
7-
pull_request:
8-
types:
9-
- opened
10-
- synchronize
11-
- reopened
6+
- 'develop-*'
7+
tags:
8+
- 'v*.*.*'
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
required: false
13+
description: 'Tag to build (e.g., v1.2.3)'
14+
1215

1316
jobs:
14-
build:
17+
build-heroku-cli-container:
1518
runs-on: ubuntu-latest
16-
1719
steps:
18-
- uses: actions/checkout@v5
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.inputs.tag }}
24+
25+
- name: Read version from file and set output
26+
id: version
27+
run: |
28+
VERSION=$(cat VERSION)
29+
echo "VERSION=$VERSION"
30+
echo "version=$VERSION" >> $GITHUB_OUTPUT
1931
20-
- run: docker compose --file docker-compose.test.yml build
21-
- run: docker compose --file docker-compose.test.yml run sut
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
2234

23-
- name: Slack Notification
24-
uses: act10ns/slack@v2
25-
if: always()
26-
continue-on-error: true
35+
- name: Login to GHCR
36+
uses: docker/login-action@v3
2737
with:
28-
status: ${{ job.status }}
29-
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Extract metadata (tags, labels) for Docker
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: |
50+
ghcr.io/${{ github.repository }}
51+
tags: |
52+
type=ref,event=branch
53+
type=semver,pattern={{version}},prefix=int-,match=v(\d.\d.\d)$,event=tag
54+
type=semver,pattern={{version}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
55+
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
56+
type=semver,pattern={{major}},value=${{ github.event.inputs.tag }},enable={{is_default_branch}}
57+
type=raw,value=latest,event=branch
58+
type=raw,value=heroku-cli-${{ steps.version.outputs.version }},event=branch
59+
type=raw,value=dev,enable=${{ startsWith(github.ref_name, 'develop-') }}
60+
61+
- name: Build and push Docker images
62+
id: push
63+
uses: docker/build-push-action@v6
64+
with:
65+
file: ./Dockerfile
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
# platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
70+
platforms: linux/amd64
71+
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 }}

0 commit comments

Comments
 (0)