-
Notifications
You must be signed in to change notification settings - Fork 3
114 lines (105 loc) · 3.62 KB
/
release-docker.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
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
104
105
106
107
108
109
110
111
112
113
114
# **what?**
# This workflow will generate a series of docker images for dbt and push them to the github container registry
#
# **why?**
# Docker images for dbt are used in a number of important places throughout the dbt ecosystem.
# This is how we keep those images up-to-date.
#
# **when?**
# This is triggered manually
name: Docker release
permissions:
packages: write
on:
workflow_dispatch:
inputs:
package:
description: The package to release
type: choice
options:
- dbt-core
- dbt-bigquery
- dbt-postgres
- dbt-redshift
- dbt-snowflake
- dbt-spark
required: true
version_number:
description: The version number to release as a SemVer (e.g. 1.0.0b1, without `latest` or `v`)
required: true
test_run:
description: Test Run (don't publish)
type: boolean
default: true
workflow_call:
inputs:
package:
description: The package to release
type: string
required: true
version_number:
description: The version number to release as a SemVer (e.g. 1.0.0b1, without `latest` or `v`)
type: string
required: true
test_run:
description: Test Run (don't publish)
type: boolean
default: true
jobs:
version_metadata:
name: Get version metadata
runs-on: ubuntu-latest
outputs:
fully_qualified_tags: ${{ steps.tags.outputs.fully_qualified_tags }}
steps:
- name: Get the tags to publish
id: tags
# this cannot be relative because this workflow is called from multiple repos
# in addition to a manual trigger
uses: dbt-labs/dbt-release/.github/actions/latest-wrangler@main
with:
package_name: ${{ inputs.package }}
new_version: ${{ inputs.version_number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
setup_image_builder:
name: Set up Docker image builder
runs-on: ubuntu-latest
needs: [version_metadata]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
build_and_push:
name: Build images and push to GHCR
runs-on: ubuntu-latest
needs: [setup_image_builder, version_metadata]
steps:
- name: Get docker build arg
id: build_arg
run: |
BUILD_ARG_NAME=$(echo ${{ inputs.package }} | sed 's/\-/_/g')
BUILD_ARG_VALUE=$(echo ${{ inputs.package }} | sed 's/postgres/core/g')
echo "name=$BUILD_ARG_NAME" >> $GITHUB_OUTPUT
echo "value=$BUILD_ARG_VALUE" >> $GITHUB_OUTPUT
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log publishing configuration
shell: bash
run: |
echo Package: ${{ inputs.package }}
echo Version: ${{ inputs.version_number }}
echo Tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }}
echo Build Arg Name: ${{ steps.build_arg.outputs.name }}
echo Build Arg Value: ${{ steps.build_arg.outputs.value }}
- name: Build and push `${{ inputs.package }}`
if: ${{ !inputs.test_run }}
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
push: True
target: ${{ inputs.package }}
build-args: ${{ steps.build_arg.outputs.name }}_ref=${{ steps.build_arg.outputs.value }}@v${{ inputs.version_number }}
tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }}