-
Notifications
You must be signed in to change notification settings - Fork 487
178 lines (161 loc) · 5.84 KB
/
publish.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Publish
on:
# push:
# branches: master
repository_dispatch:
types: [ ci-success ]
workflow_dispatch:
inputs:
installer_version:
required: false # Is this required if I have a default?
description: "The version of Fluvio to download with install.sh"
default: "stable"
workflow_call:
inputs:
installer_version:
required: false
type: string
description: "The version of Fluvio to download with install.sh"
default: "stable"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE: true # Needed so `make` targets make public changes
jobs:
setup:
name: Setup inputs
runs-on: ubuntu-latest
outputs:
pub_ref: ${{ steps.out.outputs.pub_ref }}
pub_sha: ${{ steps.out.outputs.pub_sha }}
steps:
- name: Default Info
run: |
echo event_name ${{ github.event_name }}
echo "pub_ref=${{ github.ref }}" >> $GITHUB_ENV
echo "pub_sha=${{ github.sha }}" >> $GITHUB_ENV
- name: Received ci-success event
if: github.event_name == 'repository_dispatch'
id: recv
run: |
echo REF ${{ github.event.client_payload.ref }}
echo SHA ${{ github.event.client_payload.sha }}
echo "pub_ref=${{ github.event.client_payload.ref }}" >> $GITHUB_ENV
echo "pub_sha=${{ github.event.client_payload.sha }}" >> $GITHUB_ENV
- name: Output Setup
# merge optional step output
id: out
run: |
echo REF ${{ env.pub_ref }}
echo SHA ${{ env.pub_sha }}
echo "pub_ref=${{ env.pub_ref }}" >> $GITHUB_OUTPUT
echo "pub_sha=${{ env.pub_sha }}" >> $GITHUB_OUTPUT
# Re-tag the docker image for this commit as 'latest'
docker:
name: Publish Docker Image
needs: setup
runs-on: ubuntu-latest
env:
TGT_SHA: ${{ needs.setup.outputs.pub_sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.setup.outputs.pub_sha }}
- name: Publish latest development Fluvio Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: make docker-push-manifest-dev
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
# Download the `fluvio` release artifact for each target and publish them to packages.fluvio.io
fluvio:
name: Publish Fluvio CLI
needs: setup
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_PKG_USER_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_PKG_USER_SECRET_KEY }}
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
TGT_SHA: ${{needs.setup.outputs.pub_sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.setup.outputs.pub_sha }}
- name: Install fluvio-package
env:
CHANNEL_TAG: stable # We want to ensure we install the stable version of CLI
run: |
if [ -n "${{ github.event.inputs.installer_version }}" ]; then
export VERSION=${{ github.event.inputs.installer_version }}
else
export VERSION=stable
fi
echo "VERSION=$VERSION"
make curl-install-fluvio
make install-fluvio-package
- name: Download dev release
run: make download-fluvio-release
- name: Publish artifacts
env:
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
FLUVIO_BIN: ~/.fluvio/bin/fluvio
run: make publish-artifacts-dev
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
# Bump the latest version of the Fluvio CLI on the package registry
# This serves as the final step in the publishing process, and therefore
# depends on all other jobs to have completed successfully.
# If the 'latest' tag gets bumped, you can be sure the whole publish flow succeeded.
bump_fluvio:
name: Bump Fluvio CLI version
needs: [setup, docker, fluvio]
permissions:
contents: write
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_PKG_USER_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_PKG_USER_SECRET_KEY }}
TGT_SHA: ${{ needs.setup.outputs.pub_sha }}
steps:
- name: Checkout ${{needs.setup.outputs.pub_sha }}
uses: actions/checkout@v4
with:
ref: ${{needs.setup.outputs.pub_sha }}
- name: Install stable Fluvio CLI
env:
CHANNEL_TAG: stable
run: |
make curl-install-fluvio
- name: Bump latest version of Fluvio CLI with fluvio-packages
env:
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
FLUVIO_BIN: ~/.fluvio/bin/fluvio
run: make bump-fluvio-latest
- name: Repo dispatch publish-success
uses: peter-evans/repository-dispatch@v3
with:
event-type: publish-success
client-payload: '{"ref": "${{ needs.setup.outputs.pub_ref }}", "sha": "${{ needs.setup.outputs.pub_sha }}"}'
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: ${{ !success() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}