disable 2nd publish #12
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
# this is our action playground which is triggered whenever this file is changes | |
name: playground # becomes $GITHUB_WORKFLOW | |
on: | |
push: | |
paths: [ '.github/workflows/playground.yml' ] | |
env: | |
CE_SUBJECT: "${GITHUB_REPOSITORY}-infra" | |
jobs: | |
# key becomes $GITHUB_JOB | |
build: | |
name: Build Playground | |
strategy: | |
matrix: | |
# platform: [ubuntu-latest, macos-latest, windows-latest] | |
platform: [ubuntu-latest] | |
runs-on: ${{matrix.platform}} | |
steps: | |
- name: Send Kafka Publish Event with Docker | |
id: send-kafka-pub-event-playground # becomes $GITHUB_ACTION | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main | |
run: | | |
docker run -e KAFKA_PRODUCER_TOPIC_URL="${{secrets.KAFKA_PRODUCER_TOPIC_URL}}" -e KAFKA_PRODUCER_API_SECRET="${{secrets.KAFKA_PRODUCER_API_SECRET}}" ghcr.io/tillkuhn/rubin:latest \ | |
-ce -key "$GITHUB_REPOSITORY/$GITHUB_WORKFLOW/$GITHUB_JOB" -header "producer=rubin/cli latest" \ | |
-source "urn:ci:$GITHUB_REPOSITORY/$GITHUB_WORKFLOW/$GITHUB_JOB" \ | |
-type "net.timafe.event.ci.published.v1" -subject "$CE_SUBJECT" \ | |
-record "{\"action\":\"$GITHUB_ACTION\",\"actor\":\"$GITHUB_ACTOR\",\"commit\":\"$GITHUB_SHA\",\"run_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\",\"version\":\"${GITHUB_REF#refs/*/}\"}" | |
- name: Install latest rubin Kafka Record Producer | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main | |
run: | | |
curl -LsSo ${{ runner.temp }}/rubin.zip $(curl -LsS 'https://api.github.com/repos/tillkuhn/rubin/releases/latest' | jq -r '.assets[] | select(.name|endswith("linux_amd64.zip")).browser_download_url') | |
unzip ${{ runner.temp }}/rubin.zip -d ${{ runner.temp }} && chmod u+g ${{ runner.temp }}/rubin | |
- name: Publish additional Kafka Event with CLI | |
id: test-kafka-messaging | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main | |
run: | | |
${{ runner.temp }}/rubin -help | |
env: | |
KAFKA_PRODUCER_TOPIC_URL: ${{ secrets.KAFKA_PRODUCER_TOPIC_URL }} | |
KAFKA_PRODUCER_API_SECRET: ${{ secrets.KAFKA_PRODUCER_API_SECRET }} | |
# # test hcp secrets integration | |
# - shell: bash | |
# env: | |
# # shared with HCP Vault | |
# CONFLUENT_CLUSTER_ID: ${{ secrets.CONFLUENT_CLUSTER_ID }} | |
# CONFLUENT_CLUSTER_REST_ENDPOINT: ${{ secrets.CONFLUENT_CLUSTER_REST_ENDPOINT }} | |
# CONFLUENT_PRODUCER_BASIC_AUTH: ${{ secrets.CONFLUENT_PRODUCER_BASIC_AUTH }} | |
# # default variables: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | |
# # optimize json quoting https://superuser.com/questions/1650325/setting-variable-inside-curl-json-request-with-single-quotes-in-bash | |
# run: | | |
# curl -isSH "Content-Type:application/json" -H "Authorization:Basic $CONFLUENT_PRODUCER_BASIC_AUTH" \ | |
# "$CONFLUENT_CLUSTER_REST_ENDPOINT/kafka/v3/clusters/$CONFLUENT_CLUSTER_ID/topics/$CONFLUENT_TOPIC/records" \ | |
# -d '{"key":{"type":"BINARY","data":"'$key'"},"value":{"type":"JSON","data":{"sha":"'$GITHUB_SHA'","workflow":"'$GITHUB_WORKFLOW'"}}}' |