Skip to content

Commit

Permalink
Ping on push, not PR, document role of dist-updater (#5137)
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Nov 30, 2020
1 parent 04668cc commit 9881fc5
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ jobs:
with:
fetch-depth: 0

- name: Release branch version
id: release
run: echo ::set-output name=branch::v1.0.1
- name: Checkout release branch
uses: actions/checkout@v2
with:
ref: 'v1.0.1'
ref: ${{ steps.release.outputs.branch }}
path: './release'

- name: Check for relevant changes
if: github.event_name == 'push'
uses: dorny/paths-filter@v2
id: release
id: update
with:
list-files: shell
filters: |
Expand All @@ -45,24 +48,24 @@ jobs:
- name: Changed files
if: github.event_name == 'push'
run: |
echo updated: ${{ steps.release.outputs.updated_files }}
echo deleted: ${{ steps.release.outputs.deleted_files }}
echo updated: ${{ steps.update.outputs.updated_files }}
echo deleted: ${{ steps.update.outputs.deleted_files }}
- name: Set up Ruby
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1
- name: but use cache to speed that up
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle install
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
run: |
bundle config path vendor/bundle
bundle update sheldon --jobs 4 --retry 3
Expand All @@ -72,27 +75,30 @@ jobs:
if: github.event_name == 'workflow_dispatch'

- name: update the timestamps and add the changes
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.release.outputs.updated_files }}
if: github.event_name == 'push' && steps.release.outputs.updated == 'true'
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.update.outputs.updated_files }}
if: github.event_name == 'push' && steps.update.outputs.updated == 'true'

- name: delete deleted files
run: cd release && git rm ${{ steps.release.outputs.deleted_files }}
if: github.event_name == 'push' && steps.release.outputs.deleted == 'true'
run: cd release && git rm ${{ steps.update.outputs.deleted_files }}
if: github.event_name == 'push' && steps.update.outputs.deleted == 'true'

- uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: 'release'
commit_message: Releasing ${{ steps.release.outputs.updated_files }} ${{ steps.release.outputs.deleted_files }}
if: github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')
commit_message: Releasing ${{ steps.update.outputs.updated_files }} ${{ steps.update.outputs.deleted_files }}
if: github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true')

- uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: 'release'
commit_message: ${{ github.event.inputs.commit_message }}
if: github.event_name == 'workflow_dispatch'

- name: ping distribution-updater
# https://styles-update.zotero.org:8826/ is for Zotero (styles page, API's citation server, client style updates, etc.)
# https://styles-update.zotero.org:8827/ is for the Zotero-run instance of https://github.com/citation-style-language/distribution-updater
# that performs the updating of the (to-be-deprecated) https://github.com/citation-style-language/styles-distribution/ repo
- name: ping Zotero servers
if: github.repository == 'citation-style-language/styles'
run: |
curl -H 'Content-Length:' -H "Authorization: $DISTRIBUTION_UPDATER_TOKEN" -F 'payload={"type":"pull_request","branch":"master","status":0,"commit":"'$GITHUB_SHA'"}' https://styles-update.zotero.org:8826/
curl -H 'Content-Length:' -H "Authorization: $DISTRIBUTION_UPDATER_TOKEN" -F 'payload={"type":"pull_request","branch":"master","status":0,"commit":"'$GITHUB_SHA'"}' https://styles-update.zotero.org:8827/
curl -H 'Content-Length:' -H "Authorization: $ZOTERO_UPDATE_TOKEN" -F 'payload={"type":"push","branch":"${{ steps.release.outputs.branch }}","status":0,"commit":"'$GITHUB_SHA'"}' https://styles-update.zotero.org:8826/
curl -H 'Content-Length:' -H "Authorization: $ZOTERO_UPDATE_TOKEN" -F 'payload={"type":"push","branch":"${{ steps.release.outputs.branch }}","status":0,"commit":"'$GITHUB_SHA'"}' https://styles-update.zotero.org:8827/

0 comments on commit 9881fc5

Please sign in to comment.