-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (79 loc) · 2.72 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
# **what?**
# This workflow generates a docker image and pushes it 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 indirectly via a release pipeline
name: "Docker release"
run-name: "Docker release: `${{ inputs.package }}==${{ inputs.version }}`"
permissions:
packages: write
on:
workflow_call:
inputs:
package:
description: "The package to release"
type: string
default: ${{ github.event.repository.name }}
version_number:
description: "The version number to release (e.g. 1.0.0b1, without `latest` or `v`)"
type: string
required: true
dockerfile:
description: "The path to the docker file from the repo root"
type: string
default: "docker/Dockerfile"
platforms:
description: "The platforms to publish as a comma-delimited string"
type: string
default: "linux/amd64"
test_run:
description: "Test run (don't publish)"
type: boolean
default: true
jobs:
tags:
name: "Get container tags"
runs-on: ubuntu-latest
outputs:
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
uses: dbt-labs/dbt-release/.github/actions/latest-wrangler
with:
package_name: ${{ inputs.package }}
new_version: ${{ inputs.version_number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build-and-release:
name: "Set up Docker image builder, build and push"
runs-on: ubuntu-latest
needs: [tags]
steps:
- name: "[DEBUG] Log inputs"
shell: bash
run: |
echo Package: ${{ inputs.package }}
echo Version: ${{ inputs.version_number }}
echo Tags: ${{ needs.tags.outputs.tags }}
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
- name: "Log in to GHCR"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build `${{ inputs.package }}==${{ inputs.version_number }}`; push: ${{ !inputs.test_run }}"
uses: docker/build-push-action@v5
with:
file: ${{ inputs.dockerfile }}
push: ${{ !inputs.test_run }}
platforms: ${{ inputs.platforms }}
target: ${{ inputs.package }}
build-args: commit_ref=v${{ inputs.version_number }}
tags: ${{ needs.tags.outputs.tags }}