Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix master commit msg #34

Merged
merged 3 commits into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 67 additions & 40 deletions .github/workflows/on-master-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,81 @@ on:

jobs:
run-unit-tests:
name: Run Unit Tests
uses: ./.github/workflows/test.yaml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# name: Run Unit Tests
# uses: ./.github/workflows/test.yaml
# secrets:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Throw Erorr
run: exit 1

license-check:
name: License Check
uses: ./.github/workflows/license-check.yaml
# name: License Check
# uses: ./.github/workflows/license-check.yaml
runs-on: ubuntu-latest
steps:
- name: Throw Erorr
run: exit 1

lint:
name: Lint
uses: ./.github/workflows/lint-go.yaml
# name: Lint
# uses: ./.github/workflows/lint-go.yaml
runs-on: ubuntu-latest
steps:
- name: Throw Erorr
run: exit 1

run-e2e-tests:
name: E2E Tests
uses: ./.github/workflows/test-e2e.yaml
# name: E2E Tests
# uses: ./.github/workflows/test-e2e.yaml
runs-on: ubuntu-latest
steps:
- name: Throw Erorr
run: exit 1

generate-tags:
name: Generate Docker 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"
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"
- name: Throw Erorr
run: exit 1

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
# 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
runs-on: ubuntu-latest
steps:
- name: Throw Erorr
run: exit 1

notify-slack:
name: Notify Slack
Expand All @@ -70,11 +94,14 @@ jobs:
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')
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=$(echo ${{ github.event.head_commit.message }} | head -n 1)" >> "$GITHUB_ENV"
echo "commit_message=$(git show-branch --no-name HEAD)" >> "$GITHUB_ENV"

- name: Notify Slack
uses: slackapi/[email protected]
Expand Down
Loading