-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (75 loc) · 2.42 KB
/
prerelease.yml
File metadata and controls
84 lines (75 loc) · 2.42 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
name: Pre-release
on:
push:
branches: [main]
# Skip pre-release for changes that don't affect the built artifact.
paths-ignore:
- '**.md'
- '.github/dependabot.yml'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE/**'
- '.coderabbit.yaml'
- '.gitleaks.toml'
- '.pre-commit-config.yaml'
- '.yamllint.yml'
- '.gitignore'
- 'LICENSE'
permissions:
contents: write
jobs:
prerelease:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24.14.0
cache: npm
- name: Get current version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Get next pre-release number
id: prerelease
env:
BASE_VERSION: ${{ steps.version.outputs.version }}
run: |
LATEST=$(git tag -l "v${BASE_VERSION}-pre.*" --sort=-version:refname | head -n1)
if [ -z "$LATEST" ]; then
NUM=1
else
PREFIX="v${BASE_VERSION}-pre."
NUM="${LATEST#"$PREFIX"}"
NUM=$((NUM + 1))
fi
TAG="v${BASE_VERSION}-pre.${NUM}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- run: npm ci
- run: npm run build
- run: cp dist/index.html docker-compose-debugger.html
- name: Create pre-release tag
env:
TAG: ${{ steps.prerelease.outputs.tag }}
run: |
git tag "$TAG"
git push origin "$TAG"
# The repo has immutable releases enabled. softprops/action-gh-release
# creates and publishes in one step, which means the asset upload races
# against the immutable lockdown and fails. Create as draft, upload the
# asset, then publish in a follow-up step.
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.prerelease.outputs.tag }}
files: docker-compose-debugger.html
generate_release_notes: true
prerelease: true
draft: true
- name: Publish pre-release
env:
TAG: ${{ steps.prerelease.outputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit "$TAG" --repo "${{ github.repository }}" --draft=false