diff --git a/.github/workflow/release.yml b/.github/workflow/release.yml new file mode 100644 index 0000000..210fb16 --- /dev/null +++ b/.github/workflow/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + branches: [ 2.0 ] + # tags: + # - '*' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + php: [7.4, 8.0, 8.1, 8.2, 8.3] + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install Composer Dependencies + run: | + composer check-platform-reqs && composer install --no-dev --prefer-dist -o + + - name: Create vendor.phar + run: | + mkdir temp + cp -r vendor temp/ + cp composer.json temp/ + php -d phar.readonly=0 vendor/bin/phar-composer build temp vendor.phar + + - name: Package Files + run: | + mkdir MarkdownParse + mv vendor.phar MarkdownParse/ + cp LICENSE.md MarkdownParse/ + cp MarkdownParse.php MarkdownParse/ + cp Plugin.php MarkdownParse/ + cp README.md MarkdownParse/ + zip -r MarkdownParse.zip MarkdownParse + + - name: Get Latest Release Version + id: get_latest_release + run: echo "::set-output name=version::$(curl -s https://api.github.com/repos/mrgeneralgoo/typecho-markdown/releases/latest | jq -r .tag_name)" + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} + artifacts: "MarkdownParse.zip" + body: | + **Full Changelog**: https://github.com/mrgeneralgoo/typecho-markdown/compare/${{ steps.get_latest_release.outputs.version }}...${{ github.ref }}) \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1b95b9f..aea223f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tests/usr -vendor \ No newline at end of file +vendor +vendor.phar \ No newline at end of file diff --git a/MarkdownParse.php b/MarkdownParse.php index cf394f8..4a999a4 100644 --- a/MarkdownParse.php +++ b/MarkdownParse.php @@ -5,7 +5,7 @@ if (file_exists(__DIR__ . '/vendor/autoload.php')) { require_once __DIR__ . '/vendor/autoload.php'; } elseif (file_exists(__DIR__ . 'vendor.phar')) { - require_once 'phar://' . __DIR__ . '/vendor.phar/autoload.php'; + require_once 'phar://' . __DIR__ . '/vendor.phar/vendor/autoload.php'; } use League\CommonMark\Environment\Environment;