-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (101 loc) · 3.23 KB
/
cloud2code.yaml
File metadata and controls
103 lines (101 loc) · 3.23 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# a pipeline to create container image on changes to cloud2code.rb file
name: cloud2code
on:
push:
branches:
- main
paths:
- 'cloud2code.rb'
- cloud2code/Dockerfile
- .github/workflows/cloud2code.yaml
env:
REGISTRY: ghcr.io
IMAGE_NAME: stackgenhq/cloud2code
jobs:
build:
outputs:
image_tag: ${{ steps.meta.outputs.tags }}
version: ${{ steps.version.outputs.VERSION }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
tag-suffix: -amd
- platform: linux/arm64
runner: ubuntu-22.04-arm
tag-suffix: -arm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
sparse-checkout: |
cloud2code
cloud2code.rb
- name: Get cloud2code version
id: version
run: |
echo "VERSION=$(grep 'version' cloud2code.rb | awk '{print $NF}' | tr -d '"')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.version.outputs.VERSION }}
type=raw,value=latest
flavor: |
suffix=${{ matrix.tag-suffix }},onlatest=false
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build and push
uses: docker/build-push-action@v6
with:
context: ./cloud2code
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
push: true
provenance: false
labels: ${{ steps.meta.outputs.labels }}
build-args: |-
CLOUD2CODE_VERSION=${{ steps.version.outputs.VERSION }}
create_manifest:
name: Create manifest
runs-on: ubuntu-22.04
needs: build
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest
run: |
docker buildx imagetools create \
-t ghcr.io/stackgenhq/cloud2code:latest \
ghcr.io/stackgenhq/cloud2code:latest-amd \
ghcr.io/stackgenhq/cloud2code:latest-arm
docker buildx imagetools create \
-t ghcr.io/stackgenhq/cloud2code:${{ needs.build.outputs.version }} \
ghcr.io/stackgenhq/cloud2code:${{ needs.build.outputs.version }}-amd \
ghcr.io/stackgenhq/cloud2code:${{ needs.build.outputs.version }}-arm