💚 fix publish workflow #6
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: | |
lint: | |
uses: ./.github/workflows/lint.yml | |
test: | |
uses: ./.github/workflows/test.yml | |
docker-build: | |
uses: ./.github/workflows/docker-build.yml | |
publish-docker-images: | |
needs: | |
- lint | |
- test | |
- docker-build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up context | |
uses: FranzDiebold/[email protected] | |
- name: Extract metadata (tags, labels) for Docker | |
id: docker_metadata | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKER_HUB_USERNAME }}/eimis-synapse-tools | |
tags: | | |
type=raw,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }},value=${{ env.CI_ACTION_REF_NAME_SLUG }} | |
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=EIMIS | |
- name: Login to Docker registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ vars.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and publish image(s) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.docker_metadata.outputs.tags }} | |
labels: ${{ steps.docker_metadata.outputs.labels }} | |
dockerhub-description: | |
needs: | |
- publish-docker-images | |
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@v37 | |
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_USERNAME }} | |
short-description: Docker image for https://github.com/${{ github.repository }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: ${{ secrets.DOCKER_HUB_USERNAME }}/eimis-synapse-tools | |
readme-filepath: README.md |