forked from kaitranntt/CLIProxyAPIPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (77 loc) · 2.46 KB
/
Copy pathrelease.yaml
File metadata and controls
83 lines (77 loc) · 2.46 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
name: goreleaser
run-name: >-
goreleaser tag=${{ inputs.tag || github.ref_name }}
commit=${{ inputs.commit || github.sha }}
on:
push:
# run only against tags
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: Existing fork tag to release, for example v6.9.36-0
required: false
type: string
commit:
description: Exact commit the supplied fork tag must resolve to
required: false
type: string
permissions:
contents: write
concurrency:
group: goreleaser-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
ref: ${{ inputs.tag || github.ref }}
- run: git fetch --force --tags
- name: Verify requested release commit
if: inputs.commit != ''
env:
EXPECTED_COMMIT: ${{ inputs.commit }}
run: test "$(git rev-parse HEAD)" = "${EXPECTED_COMMIT}"
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '>=1.26.0'
cache: true
- name: Generate Build Metadata
run: |
VERSION="${{ inputs.tag }}"
if [ -z "$VERSION" ]; then
VERSION="${GITHUB_REF_NAME}"
fi
{
echo "VERSION=${VERSION}"
echo "COMMIT=$(git rev-parse --short HEAD)"
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
} >> "$GITHUB_ENV"
- name: Check existing release
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${VERSION}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "[i] ${VERSION} release already exists; skipping GoReleaser."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- uses: goreleaser/goreleaser-action@5fdedb94abba051217030cc86d4523cf3f02243d
if: steps.release.outputs.exists != 'true'
with:
distribution: goreleaser
version: v2.17.0
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
COMMIT: ${{ env.COMMIT }}
BUILD_DATE: ${{ env.BUILD_DATE }}