Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make update-mirror.yml trigger builds on new tags #12

Merged
merged 1 commit into from
Nov 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/update-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,33 @@ jobs:
fetch-depth: 0
ref: upstream/master

- name: Update mirror
- name: Fetch updates from official repository
run: |
git config pull.ff only
git remote add official git://git.kitenet.net/git-annex
git pull --tags official master
git push --tags origin upstream/master

- name: Determine new tags
run: |
comm -23 <(git tag | sort) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool -- didn't know about comm, nice

<(git ls-remote --tags --refs origin \
| awk '{print $2}' \
| xargs git for-each-ref --format '%(refname:strip=2)' \
| sort) > new-tags.txt

- name: Push new objects to mirror
run: git push --tags origin upstream/master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just push upstream/master here but push tags only after uploading the built artifact. This way if build (but not testing) fails, we have a chance to adjust our workflow and cause rebuild of all the "yet to be done" tags. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yarikoptic So are you expecting the build workflows to only ever be manually/programmatically dispatched using tags, not commit hashes or other refspecs? The build workflows will need to be edited to pull the input tags from the official repository and then push them at the end, something that doesn't apply to general commitishes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, I see... oh well, then let's keep as is to keep it simple(r) for now


- name: Trigger workflow runs for new tags
run: |
while read tag
do for workflow in build-macos.yaml build-ubuntu.yaml build-windows.yaml
do jq -n --arg tag "$tag" '{ref: "master", inputs: {commitish: $tag}}' | \
curl -fsSL -X POST -d@- \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/datalad/git-annex/actions/workflows/"$workflow"/dispatches
done
done < new-tags.txt

# vim:set sts=2: