Skip to content

Commit

Permalink
👷 Some CI enhencements
Browse files Browse the repository at this point in the history
  • Loading branch information
llaumgui committed Dec 21, 2023
1 parent 89b6bb5 commit 02dc4ab
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/devops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ jobs:
# Dockerfile tests
#
test_dockerfiles:
if: github.event.schedule == ''
runs-on: ubuntu-latest
name: Linters for Dockerfile
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: hadolint
if: github.event.schedule == ''
uses: hadolint/[email protected]
with:
recursive: true
Expand All @@ -72,6 +72,7 @@ jobs:
# SonarCloud job
#
test_sonar:
if: github.event_name != 'pull_request'
needs: [
test_python,
test_markdownlint,
Expand All @@ -85,7 +86,6 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
if: github.event_name != 'pull_request'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
# Build and deploy job (only on main)
#
docker_build_deploy:
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v')
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || ${{ startsWith(github.ref, 'refs/tags/v') }})
needs: [
test_docker
]
Expand All @@ -187,13 +187,11 @@ jobs:
# Login against 2 Docker registries except on PR
# https://github.com/docker/login-action
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log into registry ${{ env.GHCR_REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
Expand Down Expand Up @@ -222,10 +220,10 @@ jobs:
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:main
cache-to: type=inline
- name: Set env
if: contains(github.ref, 'refs/tags/v')
if: ${{ startsWith(github.ref, 'refs/tags/v') }})
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Build and push Docker image
if: contains(github.ref, 'refs/tags/v')
if: ${{ startsWith(github.ref, 'refs/tags/v') }})
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -242,11 +240,11 @@ jobs:
# Release job
#
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }})
needs: [
package,
]
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
name: Release on GitHub and PyPi
steps:
- name: Git checkout
Expand Down

0 comments on commit 02dc4ab

Please sign in to comment.