2020-11-15 04:42:12 +00:00
|
|
|
name: Create Release
|
2020-07-04 22:59:10 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
runs-on: ubuntu-20.04
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- uses: actions/setup-go@v2
|
|
|
|
with:
|
2020-09-18 03:39:48 +00:00
|
|
|
go-version: '1.15.2'
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
REF: ${{ github.ref }}
|
2020-10-17 20:52:38 +00:00
|
|
|
run: |
|
2020-11-08 06:42:55 +00:00
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_amd64 -v wings.go
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm64 -v wings.go
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=${REF:11}" -o build/wings_linux_arm -v wings.go
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Test
|
|
|
|
run: go test ./...
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Compress binary and make it executable
|
2020-10-17 20:52:38 +00:00
|
|
|
run: |
|
|
|
|
upx --brute build/wings_linux_amd64 && chmod +x build/wings_linux_amd64
|
|
|
|
upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64
|
2020-10-17 21:55:05 +00:00
|
|
|
upx build/wings_linux_arm && chmod +x build/wings_linux_arm
|
|
|
|
|
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
|
|
|
|
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Create checksum and add to changelog
|
|
|
|
run: |
|
|
|
|
SUM=`cd build && sha256sum wings_linux_amd64`
|
2020-10-17 20:52:38 +00:00
|
|
|
SUM2=`cd build && sha256sum wings_linux_arm64`
|
2020-10-17 21:55:05 +00:00
|
|
|
SUM3=`cd build && sha256sum wings_linux_arm`
|
|
|
|
echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n$SUM3\n\`\`\`\n" >> ./RELEASE_CHANGELOG
|
|
|
|
echo -e "$SUM\n$SUM2\n$SUM3" > checksums.txt
|
|
|
|
|
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
|
2020-07-20 01:40:01 +00:00
|
|
|
sed -i "s/ Version = \".*\"/ Version = \"${REF:11}\"/" system/const.go
|
|
|
|
git add system/const.go
|
2020-07-04 22:59:10 +00:00
|
|
|
git commit -m "bump version for release"
|
|
|
|
git push
|
2020-10-17 21:55:05 +00:00
|
|
|
|
2020-07-04 22:59:10 +00:00
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: ${{ steps.extract_changelog.outputs.version_name }}
|
|
|
|
body_path: ./RELEASE_CHANGELOG
|
|
|
|
draft: true
|
|
|
|
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
2020-10-17 21:55:05 +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:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: build/wings_linux_amd64
|
|
|
|
asset_name: wings_linux_amd64
|
|
|
|
asset_content_type: application/octet-stream
|
2020-10-17 21:55:05 +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 }}
|
|
|
|
asset_path: build/wings_linux_arm64
|
|
|
|
asset_name: wings_linux_arm64
|
|
|
|
asset_content_type: application/octet-stream
|
2020-10-17 21:55:05 +00:00
|
|
|
|
|
|
|
- name: Upload arm Binary
|
2020-10-23 04:41:00 +00:00
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: build/wings_linux_arm
|
|
|
|
asset_name: wings_linux_arm
|
|
|
|
asset_content_type: application/octet-stream
|
2020-10-17 21:55:05 +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:
|
|
|
|
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
|