mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 06:38:07 +08:00
prevent duplicate package publish on manual run, attempt 1
This commit is contained in:
parent
bdf3b8e2b4
commit
7dd5d68be3
39
.github/workflows/nightly_release.yml
vendored
39
.github/workflows/nightly_release.yml
vendored
@ -8,24 +8,30 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
uses: ./.github/workflows/run_integration_tests.yml
|
uses: ./.github/workflows/run_integration_tests.yml
|
||||||
check_date:
|
check_publish_needed:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Check latest commit
|
name: Check if this commit has already been published
|
||||||
outputs:
|
outputs:
|
||||||
should_run: ${{ steps.should_run.outputs.should_run }}
|
should_run: ${{ steps.check.outputs.should_run }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: print latest_commit
|
- name: Fetch nightly-latest tag
|
||||||
run: echo ${{ github.sha }}
|
run: |
|
||||||
|
git fetch origin nightly-latest || true
|
||||||
- id: should_run
|
- id: check
|
||||||
continue-on-error: true
|
run: |
|
||||||
name: check latest commit is less than a day ago
|
latest_commit=$(git rev-parse origin/nightly-latest || echo "")
|
||||||
if: ${{ github.event_name == 'schedule' }}
|
echo "Latest published commit: $latest_commit"
|
||||||
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|
if [ "$latest_commit" = "${{ github.sha }}" ]; then
|
||||||
|
echo "No new commit since last publish."
|
||||||
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "New commit detected."
|
||||||
|
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
build_and_publish_nightly:
|
build_and_publish_nightly:
|
||||||
needs: [check_date, tests]
|
needs: [check_publish_needed, tests]
|
||||||
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
if: ${{ needs.check_publish_needed.outputs.should_run != 'false' }}
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
name: build_and_publish_nightly
|
name: build_and_publish_nightly
|
||||||
steps:
|
steps:
|
||||||
@ -57,3 +63,10 @@ jobs:
|
|||||||
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
|
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Tag latest nightly commit
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions"
|
||||||
|
git config user.email "github-actions@github.com"
|
||||||
|
git tag -f nightly-latest ${{ github.sha }}
|
||||||
|
git push origin nightly-latest --force
|
||||||
|
Loading…
Reference in New Issue
Block a user