Skip to content

πŸš€πŸŸ‘ Prerelease #198

πŸš€πŸŸ‘ Prerelease

πŸš€πŸŸ‘ Prerelease #198

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