-
Notifications
You must be signed in to change notification settings - Fork 30
138 lines (126 loc) · 4.16 KB
/
release_prerelease.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: "🚀🟡 Prerelease"
on:
workflow_dispatch:
inputs:
version:
type: string
description: "Version to release, in format 'vX.Y.Z'"
version_shift:
type: choice
description: "Version shift, used if version is not specified"
options:
- "major"
- "minor"
- "patch"
default: "minor"
branch:
type: string
description: "Target branch to release"
default: "main"
jobs:
get_version:
name: "Get version"
runs-on: [ self-hosted, linux, light ]
permissions:
contents: read
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get Version
id: get_version
uses: datalens-tech/get-next-release-version-action@v1
with:
version_shift: ${{ github.event.inputs.version_shift }}
version_override: ${{ github.event.inputs.version }}
release_filter_target_commitish: ${{ github.event.inputs.branch }}
build_images:
name: "Build images"
needs: [ get_version ]
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
image-version: ${{ steps.build_image.outputs.image-version }}
strategy:
matrix:
include:
- image_name: "datalens-control-api"
bake_target: "dl_control_api"
- image_name: "datalens-data-api"
bake_target: "dl_data_api"
container:
image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest"
options: -v /var/run/docker.sock:/var/run/docker.sock
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
version: "${{ needs.get_version.outputs.version }}"
cr_url: "ghcr.io/${{ github.repository_owner }}"
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.cr_url }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
id: checkout
uses: actions/checkout@v2
with:
ref: "${{ github.event.inputs.branch }}"
fetch-depth: 0
- name: Build image
id: build_image
working-directory: docker_build
run: |
bake_target=${{ matrix.bake_target }}
version="${{ env.version }}"
image_version="${version#"v"}"
image_url_rc="${{ env.cr_url }}/${{ matrix.image_name }}:${image_version}-rc.1"
image_url_release="${{ env.cr_url }}/${{ matrix.image_name }}:${image_version}"
./run-project-bake "${bake_target}" \
--push \
--set "${bake_target}.tags=${image_url_rc}"
echo "image-version=${image_version}-rc.1" >> $GITHUB_OUTPUT
release:
name: "Create prerelease"
needs: [ get_version ]
runs-on: ubuntu-latest
permissions:
contents: write
env:
version: "${{ needs.get_version.outputs.version }}"
release_branch: "release/${{ needs.get_version.outputs.version }}"
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v2
with:
ref: "${{ github.event.inputs.branch }}"
fetch-depth: 0
- name: Create and push release branch
id: create_branch
if: ${{ github.event.inputs.branch != env.release_branch }}
run: |
git branch ${{ env.release_branch }}
git push origin ${{ env.release_branch }}
- name: Create prerelease
id: create_prerelease
run: |
gh release create \
--repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \
${{ env.release_tag }} \
--target ${{ env.release_branch }} \
--prerelease \
--generate-notes
env:
GH_TOKEN: ${{ github.token }}
release_tag: "${{ env.version }}-rc.1"
run_e2e_tests:
name: "Run E2E tests"
needs: [ build_images, get_version ]
uses: datalens-tech/datalens-backend/.github/workflows/run_e2e.yml@main
with:
image_version: ${{ needs.build_images.outputs.image-version }}
secrets: inherit