Merge pull request #438 from okp4/ci/codeql #539
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: [main] | |
tags: ["v*"] | |
concurrency: | |
group: publish-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
publish-docker-images: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract metadata (tags, labels) for Docker | |
id: docker_metadata | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }},${{ github.repository }} | |
tags: | | |
type=raw,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }},value=nightly | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
labels: | | |
org.opencontainers.image.vendor=OKP4 | |
- name: Login to Docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_HUB_REGISTRY_TOKEN }} | |
- name: Build and publish image(s) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.docker_metadata.outputs.tags }} | |
labels: ${{ steps.docker_metadata.outputs.labels }} | |
dockerhub-description: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Find change in readme file | |
id: readme-change | |
uses: tj-actions/changed-files@v35.9.2 | |
with: | |
files: | | |
README.md | |
- name: Docker Hub Description | |
if: steps.readme-change.outputs.any_changed == 'true' | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_REGISTRY_ID }} | |
description: Docker image for https://github.com/okp4/okp4d | |
password: ${{ secrets.DOCKER_HUB_REGISTRY_TOKEN }} | |
repository: okp4/okp4d | |
readme-filepath: README.md | |
publish-buf-proto: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Setup buf | |
uses: bufbuild/buf-setup-action@v1.23.1 | |
- name: Push okp4 proto on buf registry | |
run: | |
buf push proto --tag ${{ github.ref_type == 'tag' && github.ref_name || github.sha }} | |
env: | |
BUF_TOKEN: ${{ secrets.BUF_TOKEN }} |