ci-success #1813
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) }} |