mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-25 10:32:31 +01:00
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Code checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build
|
|
run: pnpm run build
|
|
|
|
- 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 "ci(release): bump version"
|
|
git push
|
|
|
|
- name: Create release archive
|
|
run: |
|
|
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpstan.neon phpunit.xml shell.nix
|
|
tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
|
|
|
|
- name: Extract changelog
|
|
env:
|
|
REF: ${{ github.ref }}
|
|
run: |
|
|
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
|
|
|
|
- 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: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
draft: true
|
|
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
|
body_path: ./RELEASE_CHANGELOG
|
|
|
|
- name: Upload release archive
|
|
id: upload-release-archive
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: panel.tar.gz
|
|
asset_name: panel.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload release checksum
|
|
id: upload-release-checksum
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./checksum.txt
|
|
asset_name: checksum.txt
|
|
asset_content_type: text/plain
|