2022-11-06 20:55:49 +00:00
|
|
|
name: Release
|
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2022-11-06 20:55:49 +00:00
|
|
|
- "v*"
|
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
jobs:
|
|
|
|
release:
|
2022-11-06 20:55:49 +00:00
|
|
|
name: Release
|
2023-07-15 20:40:45 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
steps:
|
2020-12-15 22:59:06 +00:00
|
|
|
- name: Code Checkout
|
2023-10-10 18:43:02 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-11-06 20:55:49 +00:00
|
|
|
|
|
|
|
- name: Setup Go
|
2023-12-19 21:38:48 +00:00
|
|
|
uses: actions/setup-go@v5
|
2020-07-04 22:59:10 +00:00
|
|
|
with:
|
2024-04-10 23:16:28 +00:00
|
|
|
go-version: "1.21.9"
|
2022-11-06 20:55:49 +00:00
|
|
|
|
|
|
|
- name: Build release binaries
|
2020-07-04 22:59:10 +00:00
|
|
|
env:
|
2022-11-06 20:55:49 +00:00
|
|
|
CGO_ENABLED: 0
|
2020-07-04 22:59:10 +00:00
|
|
|
REF: ${{ github.ref }}
|
2020-10-17 20:52:38 +00:00
|
|
|
run: |
|
2022-11-06 20:55:49 +00:00
|
|
|
GOARCH=amd64 go build -o dist/wings_linux_amd64 -v -trimpath -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" github.com/pterodactyl/wings
|
2022-11-15 03:26:20 +00:00
|
|
|
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=${REF:11}" github.com/pterodactyl/wings
|
|
|
|
chmod 755 dist/wings_linux_arm64
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Extract changelog
|
|
|
|
env:
|
|
|
|
REF: ${{ github.ref }}
|
|
|
|
run: |
|
|
|
|
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Create checksum and add to changelog
|
|
|
|
run: |
|
2022-11-15 03:33:06 +00:00
|
|
|
SUM=`cd dist && sha256sum wings_linux_amd64`
|
|
|
|
SUM2=`cd dist && sha256sum wings_linux_arm64`
|
2020-12-16 15:43:55 +00:00
|
|
|
echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG
|
|
|
|
echo -e "$SUM\n$SUM2" > checksums.txt
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Create release branch
|
|
|
|
env:
|
|
|
|
REF: ${{ github.ref }}
|
|
|
|
run: |
|
|
|
|
BRANCH=release/${REF:10}
|
|
|
|
git config --local user.email "ci@pterodactyl.io"
|
|
|
|
git config --local user.name "Pterodactyl CI"
|
|
|
|
git checkout -b $BRANCH
|
|
|
|
git push -u origin $BRANCH
|
2021-11-15 20:17:47 +00:00
|
|
|
sed -i "s/var Version = \".*\"/var Version = \"${REF:11}\"/" system/const.go
|
2020-07-20 01:40:01 +00:00
|
|
|
git add system/const.go
|
2020-07-04 22:59:10 +00:00
|
|
|
git commit -m "bump version for release"
|
|
|
|
git push
|
2022-11-06 20:55:49 +00:00
|
|
|
|
|
|
|
- name: Create release
|
2020-07-04 22:59:10 +00:00
|
|
|
id: create_release
|
2022-12-05 00:24:33 +00:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-07-04 22:59:10 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
draft: true
|
2022-12-05 00:24:33 +00:00
|
|
|
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
|
|
|
body_path: ./RELEASE_CHANGELOG
|
2022-11-06 20:55:49 +00:00
|
|
|
|
|
|
|
- name: Upload amd64 binary
|
2020-07-04 22:59:10 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2021-02-20 21:47:42 +00:00
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2022-11-15 03:33:06 +00:00
|
|
|
asset_path: dist/wings_linux_amd64
|
2020-07-04 22:59:10 +00:00
|
|
|
asset_name: wings_linux_amd64
|
|
|
|
asset_content_type: application/octet-stream
|
2022-11-06 20:55:49 +00:00
|
|
|
|
|
|
|
- name: Upload arm64 binary
|
2020-10-17 20:52:38 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2022-11-15 03:33:06 +00:00
|
|
|
asset_path: dist/wings_linux_arm64
|
2020-10-17 20:52:38 +00:00
|
|
|
asset_name: wings_linux_arm64
|
|
|
|
asset_content_type: application/octet-stream
|
2022-11-06 20:55:49 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Upload checksum
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2021-02-20 21:47:42 +00:00
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2020-10-17 20:52:38 +00:00
|
|
|
asset_path: ./checksums.txt
|
|
|
|
asset_name: checksums.txt
|
2020-07-04 22:59:10 +00:00
|
|
|
asset_content_type: text/plain
|