separate PR and push workflow
This commit is contained in:
parent
3e51b7a7d0
commit
a02233a8dd
1 changed files with 23 additions and 5 deletions
28
.github/workflows/main.yml
vendored
28
.github/workflows/main.yml
vendored
|
|
@ -31,8 +31,29 @@ env:
|
||||||
PLATFORMS: linux/amd64
|
PLATFORMS: linux/amd64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
build-pr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build commit to check.
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: ${{ env.PLATFORMS }}
|
||||||
|
push: false
|
||||||
|
|
||||||
push-build:
|
push-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'push'
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
contents: write
|
contents: write
|
||||||
|
|
@ -94,7 +115,6 @@ jobs:
|
||||||
cache-to: type=gha, scope=${{ github.workflow }}
|
cache-to: type=gha, scope=${{ github.workflow }}
|
||||||
|
|
||||||
- name: Version tag
|
- name: Version tag
|
||||||
if: github.event_name == 'push'
|
|
||||||
uses: arabcoders/action-python-autotagger@master
|
uses: arabcoders/action-python-autotagger@master
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -104,7 +124,7 @@ jobs:
|
||||||
|
|
||||||
dockerhub-sync-readme:
|
dockerhub-sync-readme:
|
||||||
needs: push-build
|
needs: push-build
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
if: endsWith(github.ref, github.event.repository.default_branch)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Sync README
|
- name: Sync README
|
||||||
|
|
@ -122,9 +142,7 @@ jobs:
|
||||||
create_release:
|
create_release:
|
||||||
needs: push-build
|
needs: push-build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Only run on master push
|
if: endsWith(github.ref, github.event.repository.default_branch) && success()
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && success()
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue