Skip to content

Commit

Permalink
Update release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
kokofixcomputers authored Oct 6, 2024
1 parent 22c545b commit 440e87a
Showing 1 changed file with 23 additions and 79 deletions.
102 changes: 23 additions & 79 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,94 +1,38 @@
name: Release
name: Build and Release

on:
push:
tags:
- "v*"
workflow_dispatch: # Allows manual triggering
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
release:
name: Release
runs-on: ubuntu-20.04
build:
runs-on: ubuntu-latest

steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: "yarn"
node-version: '16' # Change to your required Node.js version

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build:production
run: yarn install --frozen-lockfile # Use Yarn to install dependencies

- name: Create release branch and bump version
env:
REF: ${{ github.ref }}
run: |
BRANCH=release/${REF:10}
BRANCH=${BRANCH//\//_}
BRANCH=${BRANCH//__/ _}
echo "$BRANCH"
git config --local user.email "[email protected]"
git config --local user.name "Jexactyl Releases"
git checkout -b $BRANCH
git push -u origin $BRANCH
echo "Ref value: ${REF:11}"
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php
git commit -m "New Jexactyl release inbound!"
git push
- name: Create release archive
run: |
rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpunit.xml shell.nix
tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
- name: Build the project
run: yarn build:production # Adjust this command based on your build process

- name: Extract changelog
env:
REF: ${{ github.ref }}
run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
- name: Create release directory
run: mkdir -p release

- name: Create checksum and add to changelog
- name: Package the build into a tar file
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
TAR_FILE="release/${{ github.repository }}-$(date +'%Y%m%d%H%M%S').tar.gz"
tar -czf "$TAR_FILE" -C dist . # Adjust 'dist' to your build output directory
echo "Release created at $TAR_FILE"
- name: Upload release checksum
id: upload-release-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
uses: actions/upload-artifact@v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./checksum.txt
asset_name: checksum.txt
asset_content_type: text/plain
name: release-artifact
path: release/*.tar.gz

0 comments on commit 440e87a

Please sign in to comment.