forked from microsoft/winget-pkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 3.3 KB
/
winget-update.yaml
File metadata and controls
113 lines (98 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Automated WinGet update
on:
issue_comment:
types:
- created
push:
branches:
- updates
paths:
- .github/workflows/winget-update.yaml
- .versions.yaml
- make.sh
- template/**
workflow_dispatch: {}
permissions:
contents: write
pull-requests: write
jobs:
winget-update:
name: WinGet update
runs-on: ubuntu-24.04
environment: automated
if: github.event_name != 'issue_comment' || contains(github.event.comment.body, '/rerun')
steps:
- name: Checkout master branch
uses: actions/checkout@v6
with:
token: ${{ secrets.GH_TOKEN }}
ref: master
- name: Reset master branch
run: |
git remote add upstream https://github.com/microsoft/winget-pkgs.git
git fetch upstream
git reset --hard upstream/master
- name: Checkout updates branch
uses: actions/checkout@v6
with:
token: ${{ secrets.GH_TOKEN }}
ref: updates
path: updates.tmp
- name: Install mise
uses: jdx/mise-action@v3
with:
working_directory: updates.tmp
- name: Set version
run: |
echo "version=$(yq -r '.freelens' updates.tmp/.versions.yaml)" >> $GITHUB_ENV
- name: Check if version already exists
run: |
if [[ -d manifests/f/Freelensapp/Freelens/${version} ]]; then
echo "pr_type=Update" >> $GITHUB_ENV
else
echo "pr_type=New version" >> $GITHUB_ENV
fi
echo "version=$(yq -r '.freelens' updates.tmp/.versions.yaml)" >> $GITHUB_ENV
- name: Generate new manifests
run: |
mkdir -p manifests/f/Freelensapp/Freelens/${version}
cd updates.tmp
ln -s ../manifests manifests
bash -x make.sh
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Check for changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_ENV
else
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit and push to branch
if: env.changes == 'true'
uses: EndBug/add-and-commit@v9
with:
github_token: ${{ secrets.GH_TOKEN }}
default_author: github_actions
message: "${{ env.pr_type }}: Freelensapp.Freelens version ${{ env.version }}"
new_branch: Freelensapp-Freelens-${{ env.version }}
fetch: false
push: origin Freelensapp-Freelens-${{ env.version }} --set-upstream --force
- name: Create pull request
if: env.changes == 'true'
run: |-
if [[ $(gh pr view \
--repo microsoft/winget-pkgs \
--json state \
--jq .state \
freelensapp:Freelensapp-Freelens-${{ env.version }} || true) != "OPEN" ]];
then
gh pr create \
--repo microsoft/winget-pkgs \
--base master \
--head freelensapp:Freelensapp-Freelens-${{ env.version }} \
--title "${{ env.pr_type }}: Freelensapp.Freelens version ${{ env.version }}" \
--body "This PR updates the WinGet manifest for Freelensapp.Freelens version ${{ env.version }}."
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}