Repository navigation
63 lines (58 loc) · 2.64 KB
/
Copy pathrelease-clients.yml
File metadata and controls
63 lines (58 loc) · 2.64 KB
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
on:
workflow_run:
workflows: [Release]
types: [completed]
workflow_dispatch:
inputs:
tag:
description: Flipt release version tag to generate
required: true
name: Release Updates to GRPC Clients
jobs:
release_client:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Get release tag
id: get_tag
if: ${{ github.event_name == 'workflow_run' }}
run: |
# Get the latest release tag
RELEASE_TAG=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest | \
jq -r '.tag_name')
echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
echo "Release tag: $RELEASE_TAG"
# Check if it's a v1 release
if [[ $RELEASE_TAG =~ ^v1\. ]]; then
echo "is_v1=true" >> $GITHUB_OUTPUT
echo "This is a v1 release"
else
echo "is_v1=false" >> $GITHUB_OUTPUT
echo "This is not a v1 release, skipping"
fi
- name: Generate token
id: generate_token
if: ${{ (github.event_name == 'workflow_dispatch') || (github.event_name == 'workflow_run' && steps.get_tag.outputs.is_v1 == 'true') }}
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }}
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }}
- name: Trigger Workflow (Dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-go -f tag="${{ inputs.tag }}"
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-ruby -f tag="${{ inputs.tag }}"
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-dotnet -f tag="${{ inputs.tag }}"
- name: Trigger Workflow (Release)
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && steps.get_tag.outputs.is_v1 == 'true' }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
tag=$(echo $GITHUB_REF_NAME)
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-go -f tag="${tag}"
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-ruby -f tag="${tag}"
gh workflow run proto-upgrade.yml -R flipt-io/flipt-grpc-dotnet -f tag="${tag}"