Просмотр исходного кода

Update fork build config and add upstream sync

- Simplify goreleaser to linux/darwin amd64/arm64 only
- Remove Docker CI job (using GitHub Releases instead)
- Add release workflow with goreleaser
- Add monthly upstream sync workflow with conflict detection
- Add mtg-multi binaries to gitignore
pull/434/head
Alexey Dolotov 1 месяц назад
Родитель
Сommit
7ccdeff01d
5 измененных файлов: 90 добавлений и 170 удалений
  1. 0
    61
      .github/workflows/ci.yaml
  2. 28
    0
      .github/workflows/release.yml
  3. 56
    0
      .github/workflows/sync-upstream.yml
  4. 2
    0
      .gitignore
  5. 4
    109
      .goreleaser.yml

+ 0
- 61
.github/workflows/ci.yaml Просмотреть файл

118
 
118
 
119
       - name: Run linter
119
       - name: Run linter
120
         run: mise tasks run lint
120
         run: mise tasks run lint
121
-
122
-  docker:
123
-    name: Docker
124
-    runs-on: ubuntu-latest
125
-    timeout-minutes: 20
126
-    permissions:
127
-      contents: read
128
-      packages: write
129
-    steps:
130
-      - name: Checkout
131
-        uses: actions/checkout@v6
132
-        with:
133
-          submodules: recursive
134
-
135
-      - name: Get Docker meta
136
-        id: meta
137
-        uses: docker/metadata-action@v5
138
-        with:
139
-          images: |
140
-            nineseconds/mtg
141
-            ghcr.io/${{ github.repository }}
142
-          tags: |
143
-            type=semver,pattern={{version}}
144
-            type=semver,pattern={{major}}.{{minor}}
145
-            type=semver,pattern={{major}}
146
-            type=raw,value=latest,enable={{is_default_branch}}
147
-            type=raw,value=master,enable=${{ github.ref == 'refs/heads/master' }}
148
-            type=raw,value=stable,enable=${{ github.ref == 'refs/heads/stable' }}
149
-
150
-      - name: Setup QEMU
151
-        uses: docker/setup-qemu-action@v3
152
-
153
-      - name: Setup BuildX
154
-        uses: docker/setup-buildx-action@v3
155
-
156
-      - name: Login to DockerHub
157
-        if: github.event_name != 'pull_request'
158
-        uses: docker/login-action@v3
159
-        with:
160
-          username: ${{ secrets.DOCKERHUB_USERNAME }}
161
-          password: ${{ secrets.DOCKERHUB_PASSWORD }}
162
-
163
-      - name: Login to GitHub Container Registry
164
-        if: github.event_name != 'pull_request'
165
-        uses: docker/login-action@v3
166
-        with:
167
-          registry: ghcr.io
168
-          username: ${{ github.actor }}
169
-          password: ${{ secrets.GITHUB_TOKEN }}
170
-
171
-      - name: Build and push
172
-        uses: docker/build-push-action@v6
173
-        with:
174
-          pull: true
175
-          context: .
176
-          platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
177
-          push: ${{ github.event_name != 'pull_request' }}
178
-          tags: ${{ steps.meta.outputs.tags }}
179
-          labels: ${{ steps.meta.outputs.labels }}
180
-          cache-from: type=gha
181
-          cache-to: type=gha,mode=max

+ 28
- 0
.github/workflows/release.yml Просмотреть файл

1
+name: Release
2
+
3
+on:
4
+  push:
5
+    tags:
6
+      - v*
7
+
8
+permissions:
9
+  contents: write
10
+
11
+jobs:
12
+  release:
13
+    runs-on: ubuntu-latest
14
+    steps:
15
+      - uses: actions/checkout@v4
16
+        with:
17
+          fetch-depth: 0
18
+
19
+      - uses: actions/setup-go@v5
20
+        with:
21
+          go-version: "1.26"
22
+
23
+      - uses: goreleaser/goreleaser-action@v6
24
+        with:
25
+          version: latest
26
+          args: release --clean
27
+        env:
28
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 56
- 0
.github/workflows/sync-upstream.yml Просмотреть файл

1
+name: Sync with upstream
2
+
3
+on:
4
+  schedule:
5
+    - cron: "0 8 1 * *"
6
+  workflow_dispatch:
7
+
8
+jobs:
9
+  sync:
10
+    runs-on: ubuntu-latest
11
+    permissions:
12
+      contents: write
13
+      issues: write
14
+    steps:
15
+      - uses: actions/checkout@v4
16
+        with:
17
+          fetch-depth: 0
18
+
19
+      - name: Add upstream remote
20
+        run: git remote add upstream https://github.com/9seconds/mtg.git
21
+
22
+      - name: Fetch upstream
23
+        run: git fetch upstream
24
+
25
+      - name: Check for new commits
26
+        id: check
27
+        run: |
28
+          COUNT=$(git rev-list --count HEAD..upstream/master)
29
+          echo "count=$COUNT" >> "$GITHUB_OUTPUT"
30
+          echo "Upstream is $COUNT commits ahead"
31
+
32
+      - name: Merge upstream
33
+        if: steps.check.outputs.count != '0'
34
+        id: merge
35
+        run: |
36
+          git config user.name "github-actions[bot]"
37
+          git config user.email "github-actions[bot]@users.noreply.github.com"
38
+          git merge upstream/master --no-edit
39
+        continue-on-error: true
40
+
41
+      - name: Push if merge succeeded
42
+        if: steps.check.outputs.count != '0' && steps.merge.outcome == 'success'
43
+        run: git push origin master
44
+
45
+      - name: Create issue on conflict
46
+        if: steps.merge.outcome == 'failure'
47
+        uses: actions/github-script@v7
48
+        with:
49
+          script: |
50
+            await github.rest.issues.create({
51
+              owner: context.repo.owner,
52
+              repo: context.repo.repo,
53
+              title: 'Upstream sync failed — merge conflict',
54
+              body: 'Automatic merge from `9seconds/mtg:master` failed due to conflicts.\n\nResolve manually:\n```\ngit fetch upstream\ngit merge upstream/master\n# fix conflicts\ngit push origin master\n```',
55
+              labels: ['sync']
56
+            });

+ 2
- 0
.gitignore Просмотреть файл

8
 mtg
8
 mtg
9
 coverage.txt
9
 coverage.txt
10
 dist/
10
 dist/
11
+mtg-multi
12
+mtg-multi-*

+ 4
- 109
.goreleaser.yml Просмотреть файл

2
 
2
 
3
 version: 2
3
 version: 2
4
 
4
 
5
-project_name: mtg
5
+project_name: mtg-multi
6
 
6
 
7
 before:
7
 before:
8
   hooks:
8
   hooks:
11
 
11
 
12
 builds:
12
 builds:
13
   - id: default
13
   - id: default
14
-    binary: '{{ .ProjectName }}'
15
-    goos:
16
-      - darwin
17
-      - freebsd
18
-      - linux
19
-      - netbsd
20
-      - openbsd
21
-      - windows
22
-    goarch:
23
-      - 386
24
-      - amd64
25
-      - arm
26
-      - arm64
27
-    goarm:
28
-      - 6
29
-      - 7
30
-    env:
31
-      - CGO_ENABLED=0
32
-    flags:
33
-      - -trimpath
34
-      - -mod=readonly
35
-    ldflags: -s -w -X main.version={{ .Version }}
36
-    ignore:
37
-      - goos: darwin
38
-        goarch: 386
39
-      - goos: darwin
40
-        goarch: arm
41
-      - goos: freebsd
42
-        goarch: arm64
43
-      - goos: netbsd
44
-        goarch: arm64
45
-      - goos: openbsd
46
-        goarch: arm64
47
-      - goos: windows
48
-        goarch: 386
49
-      - goos: windows
50
-        goarch: arm
51
-  - id: mips
52
-    binary: '{{ .ProjectName }}'
14
+    binary: mtg-multi
53
     goos:
15
     goos:
54
       - linux
16
       - linux
55
-    goarch:
56
-      - mips
57
-      - mipsle
58
-    gomips:
59
-      - softfloat
60
-    env:
61
-      - CGO_ENABLED=0
62
-    flags:
63
-      - -trimpath
64
-      - -mod=readonly
65
-    ldflags: -s -w -X main.version={{ .Version }}
66
-  - id: arm64-v9
67
-    binary: '{{ .ProjectName }}'
68
-    goos:
69
       - darwin
17
       - darwin
70
-      - linux
71
-    goarch:
72
-      - arm64
73
-    goarm64:
74
-      - v9.0
75
-    env:
76
-      - CGO_ENABLED=0
77
-    flags:
78
-      - -trimpath
79
-      - -mod=readonly
80
-    ldflags: -s -w -X main.version={{ .Version }}
81
-  - id: amd64-v3
82
-    binary: '{{ .ProjectName }}'
83
-    goos:
84
-      - darwin
85
-      - freebsd
86
-      - linux
87
-      - netbsd
88
-      - openbsd
89
-      - windows
90
     goarch:
18
     goarch:
91
       - amd64
19
       - amd64
92
-    goamd64:
93
-      - v3
20
+      - arm64
94
     env:
21
     env:
95
       - CGO_ENABLED=0
22
       - CGO_ENABLED=0
96
     flags:
23
     flags:
102
   - id: default
29
   - id: default
103
     ids:
30
     ids:
104
       - default
31
       - default
105
-      - mips
106
-    name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
32
+    name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}'
107
     formats:
33
     formats:
108
       - tar.gz
34
       - tar.gz
109
     wrap_in_directory: true
35
     wrap_in_directory: true
110
-    format_overrides:
111
-      - goos: windows
112
-        formats:
113
-          - zip
114
     files:
36
     files:
115
       - LICENSE
37
       - LICENSE
116
       - README.md
38
       - README.md
117
-      - SECURITY.md
118
-      - BEST_PRACTICES.md
119
-      - example.config.toml
120
-  - id: optimized
121
-    ids:
122
-      - arm64-v9
123
-      - amd64-v3
124
-    name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm64 }}-{{ .Arm64 }}{{ end }}{{ if .Amd64 }}-{{ .Amd64 }}{{ end }}'
125
-    formats:
126
-      - tar.gz
127
-    wrap_in_directory: true
128
-    format_overrides:
129
-      - goos: windows
130
-        formats:
131
-          - zip
132
-    files:
133
-      - LICENSE
134
-      - README.md
135
-      - SECURITY.md
136
-      - BEST_PRACTICES.md
137
       - example.config.toml
39
       - example.config.toml
138
 
40
 
139
-gomod:
140
-  proxy: true
141
-
142
 snapshot:
41
 snapshot:
143
   version_template: '{{ .Version }}'
42
   version_template: '{{ .Version }}'
144
 
43
 
145
 checksum:
44
 checksum:
146
   name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
45
   name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
147
-
148
-source:
149
-  enabled: true
150
-  name_template: '{{ .ProjectName }}-sources'

Загрузка…
Отмена
Сохранить