-
Notifications
You must be signed in to change notification settings - Fork 70
81 lines (69 loc) · 2.15 KB
/
release.yaml
File metadata and controls
81 lines (69 loc) · 2.15 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
name: MediaWarp Releaser
on:
push:
tags:
- v*
permissions:
contents: write
packages: write
actions: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Cancel same-commit dev workflow runs
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const sha = context.sha;
const runs = await github.paginate(github.rest.actions.listWorkflowRuns, {
owner,
repo,
workflow_id: 'dev.yaml',
event: 'push',
per_page: 100,
});
const targets = runs.filter((run) =>
run.head_sha === sha &&
['queued', 'in_progress', 'waiting', 'pending', 'requested'].includes(run.status)
);
if (targets.length === 0) {
core.info(`No running dev workflow found for commit ${sha}.`);
return;
}
for (const run of targets) {
core.info(`Cancelling dev run #${run.run_number} (id=${run.id}, status=${run.status})`);
await github.rest.actions.cancelWorkflowRun({
owner,
repo,
run_id: run.id,
});
}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod" # 使用 go.mod 文件中的 golang 版本
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}