Skip to content

Commit

Permalink
fix CI pipeline for the pull requests from forks (i.e. scala-steward)…
Browse files Browse the repository at this point in the history
… excluding publish jobs
  • Loading branch information
bekiroguz committed Oct 6, 2024
1 parent 17191af commit d440a5c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches: ["**"]
tags: ["v*"]
pull_request:
branches: ["master"]

permissions:
contents: read
Expand All @@ -28,22 +30,23 @@ jobs:
- name: Run tests and coverage
run: |-
cp .jvmopts-ci .jvmopts
sbt coverage test coverageReport && bash <(curl -s https://codecov.io/bash)
sbt coverage test coverageReport && bash <(curl -s https://codecov.io/bash)
- name: Prepare draft release notes
# Run this step only for pushes to the master branch or for tags starting with 'v'
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) }}
# Run this step only in the original repo and for pushes to the master branch or for tags starting with 'v'
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && ! github.event.repository.fork }}
continue-on-error: true
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-sonatype:
permissions:
contents: write
pull-requests: write
name: Publish to Sonatype
# Publish to Sonatype only on tags starting with 'v' (stable releases) and not from forked repositories
# Publish to Sonatype only from the original repo and for the tags starting with 'v'
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ! github.event.repository.fork }}
needs: [ci]
runs-on: ubuntu-latest
Expand All @@ -65,13 +68,14 @@ jobs:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

publish-azure:
permissions:
contents: write
pull-requests: write
name: Publish to Azure
# Publish to Azure only for non-tag references (e.g., all the pushes to default and other branches) and not from forked repositories
if: ${{ ! startsWith(github.ref, 'refs/tags/') && ! github.event.repository.fork }}
# Publish to Azure all the commits for all the branches from the original repo except for tags.
if: ${{ github.event_name == 'push' && ! startsWith(github.ref, 'refs/tags/') && ! github.event.repository.fork }}
needs: [ci]
runs-on: ubuntu-latest
steps:
Expand All @@ -91,6 +95,7 @@ jobs:
AZURE_FEEDUSER: ${{ secrets.AZURE_FEEDUSER }}
AZURE_FEEDPASSWORD: ${{ secrets.AZURE_FEEDPASSWORD }}
AZURE_FEEDURL: ${{ secrets.AZURE_FEEDURL }}

dependency-submission:
name: Submit dependency graph
continue-on-error: true
Expand All @@ -112,6 +117,5 @@ jobs:
distribution: temurin
java-version: 17
cache: sbt
- name: Submit dependency graph
uses: scalacenter/sbt-dependency-submission@v2

- name: Submit dependency graph
uses: scalacenter/sbt-dependency-submission@v2

0 comments on commit d440a5c

Please sign in to comment.