-
Notifications
You must be signed in to change notification settings - Fork 6
90 lines (74 loc) · 2.4 KB
/
release.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
name: release
on:
workflow_dispatch:
inputs:
environment:
description: 'Select the deployment environment'
required: true
type: choice
options:
- production
- staging
jobs:
build-push:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment || 'production' }}
strategy:
matrix:
target: [code-indexer, terrat-ee, terrat-oss]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
MATRIX_PASSWORD: ${{ secrets.MATRIX_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
TERRATEAM_UI_ANALYTICS: ${{ github.event.inputs.environment == 'production' && vars.TERRATEAM_POSTHOG_TOKEN || 'false' }}
TERRATEAM_ENVIRONMENT: ${{ github.event.inputs.environment || 'production' }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY: ${{ github.repository }}
MATRIX_TARGET: ${{ matrix.target }}
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version tag
run: |
./scripts/version_tag >> $GITHUB_ENV
- name: Set base image
run: |
./scripts/base_image >> $GITHUB_ENV
- name: Set image tags
run: |
./scripts/image_tags >> $GITHUB_ENV
- name: Create tag
run: |
./scripts/create_tag
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v4
with:
context: .
file: docker/terrat/Dockerfile.consolidated
push: true
platforms: linux/amd64,linux/arm64
target: ${{ matrix.target }}
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
tags: ${{ env.IMAGE_TAGS }}
- name: Create release
run: ./scripts/create_release
- name: Notify Slack
run: ./scripts/notify_slack
- name: Trigger deploy
run: ./scripts/trigger_deploy