mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:57:31 +00:00
chore(ci): release pipeline for v2 (#3197)
* not working * test ci * correct path * test * test * test * remove k8s & test * test * test image * typo * test * fix * test * fix * test * fix * fix windows * fix * fix * fix codecov * fix with arch * test * test * test * test * trial * trial * trial * trial * trial * trial * trial * try * try * first improvement * trial * improve * improve * improve * use bash * trial * random test * wip * test with goreleaser and semrel * fix typo * trial * add buildx * define default * force buildkit * use buildx * debug GH docker * use images * debug docker * work around image name issues * trial * test * test with prebuilt image * fix * use load * test * use only docker * trial * test * use load * test * test with docker driver * trial * trial * trial * use arm * upload artifacts * try to cache grpc base * try to use a cache * fall back * test * fix * improve * upload artifacts * fix * name things * add tag if poc * args for protos * remove v2 build Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
281
.github/workflows/zitadel.yml
vendored
281
.github/workflows/zitadel.yml
vendored
@@ -1,27 +1,15 @@
|
||||
name: ZITADEL Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags-ignore:
|
||||
- '**'
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
ARTIFACTS_FOLDER: './artifacts'
|
||||
on:
|
||||
#pull_request:
|
||||
push:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
refs:
|
||||
name: Prepare CI Vars
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
sha_short: ${{ steps.refs.outputs.sha_short }}
|
||||
short_ref: ${{ steps.refs.outputs.short_ref }}
|
||||
version: ${{ steps.refs.outputs.version }}
|
||||
Build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -30,224 +18,55 @@ jobs:
|
||||
uses: cycjimmy/semantic-release-action@v2
|
||||
with:
|
||||
dry_run: true
|
||||
semantic_version: 17.0.4
|
||||
semantic_version: 19.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Set outputs
|
||||
id: refs
|
||||
run: |
|
||||
export BRANCH=${GITHUB_REF#refs/*/}
|
||||
echo "branch: ${BRANCH}"
|
||||
|
||||
export BRANCHTRANSLATED=$(echo ${BRANCH} | tr '/' '_')
|
||||
echo "short_ref: ${BRANCHTRANSLATED}"
|
||||
|
||||
export VERSION=""
|
||||
if ${{ steps.semantic.outputs.new_release_published == 'true' }}; then
|
||||
export VERSION=${{ steps.semantic.outputs.new_release_version }}
|
||||
else
|
||||
export VERSION=${BRANCHTRANSLATED}
|
||||
fi
|
||||
echo "New semantic release: ${{ steps.semantic.outputs.new_release_published }}"
|
||||
echo "version: ${VERSION}"
|
||||
|
||||
echo "::set-output name=short_ref::${BRANCHTRANSLATED}"
|
||||
echo "::set-output name=sha_short::SHA-$(git rev-parse --short=12 HEAD)"
|
||||
echo "::set-output name=version::${VERSION}"
|
||||
|
||||
zitadel:
|
||||
name: Build ZITADEL
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/zitadel/Dockerfile
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha,scope=${{ github.workflow }}
|
||||
cache-to: type=gha,scope=${{ github.workflow }},mode=max
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
build-args: |
|
||||
VERSION=${{ needs.refs.outputs.version }}
|
||||
driver: docker
|
||||
install: true
|
||||
- name: Run GoReleaser Snapshot
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: v1.5.0
|
||||
args: release --snapshot
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run GoReleaser Release on tag
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: v1.5.0
|
||||
args: release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/upload-artifact@v2
|
||||
name: Upload goreleaser dist
|
||||
with:
|
||||
name: zitadel
|
||||
path: /tmp/zitadel/
|
||||
|
||||
zitadel-codecov:
|
||||
name: Upload ZITADEL Codecov
|
||||
needs: [refs, zitadel]
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
name: goreleaser-dist
|
||||
path: .artifacts/goreleaser
|
||||
- uses: actions/upload-artifact@v2
|
||||
name: Upload gRPC clients
|
||||
with:
|
||||
context: .
|
||||
file: ./build/zitadel/Dockerfile
|
||||
platforms: linux/amd64
|
||||
target: go-codecov
|
||||
cache-from: type=gha,scope=${{ github.workflow }}
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
name: grpc-clients
|
||||
path: .artifacts/grpc
|
||||
- uses: actions/upload-artifact@v2
|
||||
name: Upload compiled console
|
||||
with:
|
||||
name: console
|
||||
path: .artifacts/console
|
||||
- uses: codecov/codecov-action@v1
|
||||
name: Upload go coverage
|
||||
with:
|
||||
name: zitadel-codecov
|
||||
files: /tmp/zitadel/profile.cov
|
||||
|
||||
zitadel-console:
|
||||
name: Build ZITADEL Console
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/console/Dockerfile
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha,scope=${{ github.workflow }}
|
||||
cache-to: type=gha,scope=${{ github.workflow }},mode=max
|
||||
outputs: type=local,dest=/tmp/zitadel-console
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: zitadel-console
|
||||
path: /tmp/zitadel-console/
|
||||
|
||||
zitadel-image:
|
||||
name: Package ZITADEL Image
|
||||
needs: [refs, zitadel, zitadel-console]
|
||||
runs-on: ubuntu-18.04
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: zitadel
|
||||
path: .download/zitadel
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: zitadel-console
|
||||
path: .download/zitadel/console
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: true
|
||||
cache-from: type=gha,scope=${{ github.workflow }}
|
||||
cache-to: type=gha,scope=${{ github.workflow }},mode=max
|
||||
release:
|
||||
name: Semantic Release Images and Artifacts
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [ refs, zitadel-image ]
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ github.repository_owner }}
|
||||
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- name: Docker Pull ZITADEL Image
|
||||
run: docker pull $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.sha_short }}
|
||||
- name: Download zitadelctl Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: ${{ env.ARTIFACTS_FOLDER }}/
|
||||
- name: Workaround for exe
|
||||
run: |
|
||||
mv ${ARTIFACTS_FOLDER}/zitadelctl-windows-amd64/zitadelctl-windows-amd64 ${ARTIFACTS_FOLDER}/zitadelctl-windows-amd64/zitadelctl-windows-amd64.exe
|
||||
find ${ARTIFACTS_FOLDER}
|
||||
|
||||
- name: Run Semantic Release
|
||||
id: semantic
|
||||
uses: cycjimmy/semantic-release-action@v2
|
||||
with:
|
||||
dry_run: false
|
||||
semantic_version: 17.0.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Echo Semantic Release Versions
|
||||
if: steps.semantic.outputs.new_release_published == 'true'
|
||||
run: |
|
||||
echo ${{ steps.semantic.outputs.new_release_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_major_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_minor_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_patch_version }}
|
||||
- name: Docker Tag Version
|
||||
run: |
|
||||
docker tag $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.sha_short }} $REGISTRY/$GITHUB_REPOSITORY:${{ steps.semantic.outputs.new_release_version }}
|
||||
if: steps.semantic.outputs.new_release_published == 'true'
|
||||
- name: Docker Tag Latest
|
||||
run: |
|
||||
docker tag $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.sha_short }} $REGISTRY/$GITHUB_REPOSITORY:latest
|
||||
if: steps.semantic.outputs.new_release_published == 'true'
|
||||
- name: Docker Push Version
|
||||
run: |
|
||||
docker push $REGISTRY/$GITHUB_REPOSITORY:${{ steps.semantic.outputs.new_release_version }}
|
||||
if: steps.semantic.outputs.new_release_published == 'true'
|
||||
- name: Docker Push Latest
|
||||
run: |
|
||||
docker push $REGISTRY/$GITHUB_REPOSITORY:latest
|
||||
if: steps.semantic.outputs.new_release_published == 'true'
|
||||
|
||||
- name: Docker Tag Version
|
||||
run: |
|
||||
docker tag $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.sha_short }} $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.short_ref }}
|
||||
if: steps.semantic.outputs.new_release_published != 'true' && needs.refs.outputs.short_ref != 'main' && needs.refs.outputs.short_ref != ''
|
||||
- name: Docker Push Version
|
||||
run: |
|
||||
docker push $REGISTRY/$GITHUB_REPOSITORY:${{ needs.refs.outputs.short_ref }}
|
||||
if: steps.semantic.outputs.new_release_published != 'true' && needs.refs.outputs.short_ref != 'main' && needs.refs.outputs.short_ref != ''
|
||||
- name: Development Release
|
||||
id: create_release
|
||||
uses: ncipollo/release-action@v1.8.4
|
||||
if: steps.semantic.outputs.new_release_published != 'true' && needs.refs.outputs.short_ref != 'main' && needs.refs.outputs.short_ref != ''
|
||||
with:
|
||||
artifacts: "${{ env.ARTIFACTS_FOLDER }}/zitadelctl-darwin-amd64/zitadelctl-darwin-amd64,${{ env.ARTIFACTS_FOLDER }}/zitadelctl-linux-amd64/zitadelctl-linux-amd64,${{ env.ARTIFACTS_FOLDER }}/zitadelctl-windows-amd64/zitadelctl-windows-amd64.exe"
|
||||
body: |
|
||||
This is a release from a development branch.
|
||||
Do not use these artifacts in production.
|
||||
tag: ${{ needs.refs.outputs.short_ref }}-dev
|
||||
commit: ${{ needs.refs.outputs.short_ref }}
|
||||
name: Branch ${{ needs.refs.outputs.short_ref }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
replacesArtifacts: true
|
||||
prerelease: true
|
||||
draft: false
|
||||
allowUpdates: true
|
||||
- name: Create Sentry release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
uses: getsentry/action-release@v1
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||
with:
|
||||
version: zitadel-${{ needs.refs.outputs.version }}
|
||||
projects: "console zitadel zitadelctl"
|
||||
files: .artifacts/codecov/profile.cov
|
||||
name: go-codecov
|
||||
|
Reference in New Issue
Block a user