Pterodactyl-Panel/.github/workflows/release.yml

86 lines
2.8 KiB
YAML
Raw Normal View History

2020-11-15 05:01:02 +01:00
name: Create Release
2020-07-05 02:36:07 +02:00
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12'
2020-11-15 05:01:02 +01:00
2020-07-05 02:36:07 +02:00
- name: Create release branch and bump version
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
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php
git commit -m "bump version for release"
git push
- name: Build assets
run: |
yarn install
yarn run build:production
2020-11-15 05:01:02 +01:00
2020-07-05 02:36:07 +02:00
- name: Create release archive
run: |
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile
tar -czf panel.tar.gz * .env.example .babel-plugin-macrosrc.js
2020-07-05 02:36:07 +02:00
- name: Extract changelog
id: 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`
- name: Create checksum and add to changelog
run: |
SUM=`sha256sum panel.tar.gz`
echo -e "\n#### SHA256 Checksum\n\n\`\`\`\n$SUM\n\`\`\`\n" >> ./RELEASE_CHANGELOG
echo $SUM > checksum.txt
- 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-11-15 05:01:02 +01:00
2020-07-05 02:36:07 +02:00
- name: Upload binary
id: upload-release-archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2020-11-15 05:01:02 +01:00
upload_url: ${{ steps.create_release.outputs.upload_url }}
2020-07-05 02:36:07 +02:00
asset_path: panel.tar.gz
asset_name: panel.tar.gz
asset_content_type: application/gzip
2020-11-15 05:01:02 +01:00
2020-07-05 02:36:07 +02:00
- name: Upload checksum
2020-11-15 05:01:02 +01:00
id: upload-release-checksum
2020-07-05 02:36:07 +02:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2020-11-15 05:01:02 +01:00
upload_url: ${{ steps.create_release.outputs.upload_url }}
2020-07-05 02:36:07 +02:00
asset_path: ./checksum.txt
asset_name: checksum.txt
asset_content_type: text/plain