generated from getsentry/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 53
75 lines (68 loc) · 2.46 KB
/
build.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
name: "build"
on:
push:
branches:
- master
env:
# Variables defined in the repository
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
# For master we have an environment variable that selects the action-release project
# instead of action-release-prs
# For other branches: https://sentry-ecosystem.sentry.io/releases/?project=4505075304693760
# For master branch: https://sentry-ecosystem.sentry.io/releases/?project=6576594
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
jobs:
docker-build:
name: Build & pubish Docker images
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
target:
- name: builder
image: action-release-builder-image:latest
- name: app
image: action-release-image:latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# BUILDKIT_INLINE_CACHE creates the image in such a way that you can
# then use --cache-from (think of a remote cache)
# This feature is allowed thanks to using the buildx plugin
#
# There's a COPY command in the builder stage that can easily invalidate the cache
# If you notice, please add more exceptions to .dockerignore since we loose the value
# of using --cache-from on the app stage
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' }}
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.target.image }}
cache-from: ghcr.io/${{ github.repository_owner }}/${{ matrix.target.image }}
target: ${{ matrix.target.name }}
build-args: BUILDKIT_INLINE_CACHE=1
# This step creates real Sentry releases for the action itself:
# https://sentry-ecosystem.sentry.io/releases/?project=6576594
- name: Sentry Release
uses: getsentry/action-release@v1
if: vars.SENTRY_ORG != ''
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_LOG_LEVEL: debug
with:
environment: 'production'
ignore_missing: true