feat: allow injection of master key via stdin (#772) #68
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: Master branch CI | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
run-unit-tests: | |
name: Run Unit Tests | |
uses: ./.github/workflows/test.yaml | |
secrets: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
license-check: | |
name: License Check | |
uses: ./.github/workflows/license-check.yaml | |
lint: | |
name: Lint | |
uses: ./.github/workflows/lint-go.yaml | |
module-check: | |
name: Go Module Check | |
uses: ./.github/workflows/go-mod-check.yaml | |
run-e2e-tests: | |
name: E2E Tests | |
uses: ./.github/workflows/test-e2e.yaml | |
generate-tags: | |
name: Generate Docker Tags | |
runs-on: ubuntu-latest | |
outputs: | |
tag_date: ${{ steps.tag_date.outputs.tag_date }} | |
short_sha: ${{ steps.short_sha.outputs.short_sha }} | |
steps: | |
- name: Generate Tag Date | |
id: tag_date | |
run: echo "tag_date=$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT" | |
- name: Generate Short SHA | |
id: short_sha | |
run: echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> "$GITHUB_OUTPUT" | |
publish-docker-image: | |
name: Publish Docker Image | |
uses: ./.github/workflows/publish-docker-images.yaml | |
secrets: inherit | |
needs: | |
- run-unit-tests | |
- run-e2e-tests | |
- generate-tags | |
- lint | |
- license-check | |
permissions: | |
contents: read | |
packages: write | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
# eg: master-20240321-7d8e9f2 | |
tags: | | |
type=raw,value=master-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }} | |
type=raw,value=master-latest | |
notify-slack: | |
name: Notify Slack | |
needs: | |
- publish-docker-image | |
- generate-tags | |
- license-check | |
- lint | |
- module-check | |
- run-unit-tests | |
- run-e2e-tests | |
if: always() && (needs.publish-docker-image.result != 'success' || needs.run-unit-tests.result != 'success' || needs.lint.result != 'success' || needs.run-e2e-tests.result != 'success' || needs.license-check.result != 'success' || needs.module-check.result != 'success') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get the commit message | |
id: commit_message | |
# This is a workaround to get the first line of the commit message. Passing the entire message can cause the payload (JSON) to be invalid. | |
run: | | |
echo "commit_message=$(git show-branch --no-name HEAD)" >> "$GITHUB_ENV" | |
- name: Notify Slack | |
uses: slackapi/[email protected] | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
with: | |
payload: | | |
{ | |
"unit-test-status": "${{ needs.run-unit-tests.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}", | |
"docker-publish-status": "${{ needs.publish-docker-image.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}", | |
"commit-message": "${{ env.commit_message }}", | |
"commit-url": "${{ github.event.head_commit.url }}", | |
"e2e-test-status": "${{ needs.run-e2e-tests.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}", | |
"branch": "${{ github.ref }}", | |
"repository": "${{ github.repository }}", | |
"commit-author": "${{ github.event.head_commit.author.name }}", | |
"lint-status": "${{ needs.lint.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}" | |
"license-check": "${{ needs.license-check.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}" | |
"module-check": "${{ needs.module-check.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}" | |
} |