Skip to content

Commit 04feb9b

Browse files
jo-chemlagithub-actions[bot]
authored andcommitted
Update sync-fork.yml
1 parent dc294b7 commit 04feb9b

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Winget Release
2+
on:
3+
# push:
4+
# tags:
5+
# - 'v*' # run on any tag push like v8.14.3, v8.15.0 etc.
6+
release:
7+
types: [published]
8+
9+
# release:
10+
# types: [released]
11+
jobs:
12+
publish:
13+
runs-on: windows-latest
14+
steps:
15+
- name: Checkout tag
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # fetch all history so tags are available
19+
ref: ${{ github.ref }} # this ensures we check out the pushed tag
20+
- name: Winget Releaser
21+
uses: vedantmgoyal9/winget-releaser@main
22+
with:
23+
identifier: libvips.libvips
24+
installers-regex: 'w64\-all*\.zip $'
25+
token: ${{ secrets.WINGET_TOKEN }}
26+
version: ${{ github.ref_name }}

.github/workflows/sync-fork.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Sync winget-release-workflow fork branch with upstream master
2+
# Default branch set to winget-release-workflow rather than master so action can run, and changes only occur in that branch so master is synced.
3+
4+
on:
5+
schedule:
6+
- cron: '0 3 * * *' # daily at 03:00 UTC
7+
workflow_dispatch:
8+
9+
jobs:
10+
sync-master:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout fork master
14+
uses: actions/checkout@v4
15+
with:
16+
ref: master
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Add upstream remote
20+
run: |
21+
git remote add upstream https://github.com/libvips/build-win64-mxe.git || true
22+
git fetch upstream master --tags
23+
24+
- name: Hard reset fork master to upstream
25+
run: |
26+
git checkout master
27+
git reset --hard upstream/master
28+
git push origin master --force
29+
30+
sync-winget-branch:
31+
runs-on: ubuntu-latest
32+
needs: sync-master
33+
steps:
34+
- name: Checkout fork branch
35+
uses: actions/checkout@v4
36+
with:
37+
ref: winget-release-workflow
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Add upstream remote
41+
run: |
42+
git remote add upstream https://github.com/libvips/build-win64-mxe.git || true
43+
git fetch upstream master --tags
44+
45+
- name: Configure Git identity
46+
run: |
47+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
48+
git config --global user.name "github-actions[bot]"
49+
50+
- name: Rebase winget-release-workflow on upstream/master
51+
run: |
52+
git checkout winget-release-workflow
53+
git rebase upstream/master || (git rebase --abort && exit 1)
54+
git push origin winget-release-workflow --force
55+
56+
- name: Push latest upstream tag
57+
run: |
58+
# find latest tag by commit date
59+
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
60+
echo "Latest upstream tag: $LATEST_TAG"
61+
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
62+
# check if tag exists in fork
63+
if ! git ls-remote --tags origin | grep -q "refs/tags/$LATEST_TAG"; then
64+
git push origin $LATEST_TAG
65+
echo "Pushed latest tag to fork: $LATEST_TAG"
66+
else
67+
echo "Tag already exists in fork: $LATEST_TAG"
68+
fi
69+
70+
- name: Create GitHub release for latest tag
71+
uses: ncipollo/release-action@v1
72+
if: github.event_name == 'workflow_dispatch' || steps.push_tag.outputs.pushed == 'true' || !github.event_name
73+
with:
74+
tag: ${{ env.LATEST_TAG }}
75+
generateReleaseNotes: true
76+
skipIfReleaseExists: true

0 commit comments

Comments
 (0)