Merge pull request #16 from meero-com/chore/add-license #11
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: "CICD" | |
on: | |
push: | |
branches: | |
- 'main' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
runs-on: "ubuntu-latest" | |
name: "Release" | |
outputs: | |
new_release_published: ${{ steps.release.outputs.new_release_published }} | |
new_release_version: ${{ steps.release.outputs.new_release_version }} | |
new_release_major_version: ${{ steps.release.outputs.new_release_major_version }} | |
new_release_minor_version: ${{ steps.release.outputs.new_release_minor_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Semantic Release | |
id: release | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
semantic_version: 23 | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-docker-image: | |
needs: | |
- release | |
if: needs.release.outputs.new_release_published == 'true' | |
name: "Build container images" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: "amd64" | |
- name: "Checkout Code" | |
uses: "actions/checkout@v4" | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=${{ needs.release.outputs.new_release_version }} | |
type=raw,value=${{ needs.release.outputs.new_release_major_version }} | |
type=raw,value=${{ needs.release.outputs.new_release_major_version }}.${{ needs.release.outputs.new_release_minor_version }} | |
- name: Build tag, and push Container Image to Registry | |
id: build-image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: false | |
platforms: "linux/amd64" |