Repository navigation
72 lines (66 loc) · 2.97 KB
/
Copy pathrelease.yaml
File metadata and controls
72 lines (66 loc) · 2.97 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
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
name: Release
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Code checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.27.2
- name: Build release binaries
env:
CGO_ENABLED: 0
run: |
GOARCH=amd64 go build -o dist/wings_linux_amd64 -v -trimpath -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${{ github.ref_name }}" github.com/pterodactyl/wings
chmod 755 dist/wings_linux_amd64
GOARCH=arm64 go build -o dist/wings_linux_arm64 -v -trimpath -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${{ github.ref_name }}" github.com/pterodactyl/wings
chmod 755 dist/wings_linux_arm64
- name: Create release branch
env:
VERSION: ${{ github.ref_name }}
run: |
BRANCH=release/${{ env.VERSION }}
git config --local user.email "ci@pterodactyl.io"
git config --local user.name "Pterodactyl CI"
git checkout -b $BRANCH
git push -u origin $BRANCH
sed -i "s/var Version = \".*\"/var Version = \"${VERSION:1}\"/" system/const.go
git add system/const.go
git commit -m "ci(release): bump version"
git push
- name: write changelog
run: |
sed -n "/^## ${{ github.ref_name }}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
- uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
body_path: ./RELEASE_CHANGELOG
files: |
dist/*
# Hand the tagged version to pterodactyl/pterodactyl-cdn, which publishes
# https://cdn.pterodactyl.io/releases/latest.json. It can't read the
# version off the API itself, because the release above is still a draft.
# GITHUB_TOKEN deliberately cannot be used here: it has no access to
# another repository.
# RedlanceMinecraft: skipped outside of upstream, forks have no CDN to update.
- name: Update CDN release manifest
if: ${{ github.repository == 'pterodactyl/wings' && !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'alpha') }}
env:
GH_TOKEN: ${{ secrets.CDN_DISPATCH_TOKEN }}
VERSION: ${{ github.ref_name }}
run: |
jq -n --arg version "$VERSION" \
'{event_type: "release-tagged", client_payload: {component: "wings", version: $version}}' \
| gh api repos/pterodactyl/pterodactyl-cdn/dispatches --input -