diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..1797d2b --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,76 @@ +on: + push: + tags: + - "v*" + +name: Create Release + +jobs: + create-release: + name: Publish Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Pull all submodule + run: git submodule update --init --recursive + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "16" + + - name: Setup Git + run: | + git config user.name '${{secrets.MAINTAINER_NAME}}' + git config user.email '${{secrets.MAINTAINER_EMAIL}}' + + - name: Update package.json + run: | + # Extract the version from the git tag (e.g., "v1.0.0") + version=$(echo "${{ github.ref }}" | sed -e 's/^refs\/tags\/v//') + + # Update the package.json version using Node.js script + node - <> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build nextjs pages + run: pnpm run build + + - uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish-release.yml similarity index 88% rename from .github/workflows/publish.yml rename to .github/workflows/publish-release.yml index 1ee158a..42f2119 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish-release.yml @@ -1,12 +1,11 @@ +name: Publish Release on: - push: - tags: - - 'v*' - -name: Create Release + release: + types: + - published jobs: - publish: + publish-release: name: Publish Release runs-on: ubuntu-latest steps: @@ -29,7 +28,7 @@ jobs: - name: Update package.json run: | # Extract the version from the git tag (e.g., "v1.0.0") - version=$(echo "${{ github.ref }}" | sed -e 's/^refs\/tags\/v//') + version=$(echo "${{ github.event.release.tag_name }}" | sed -e 's/^refs\/tags\/v//') # Update the package.json version using Node.js script node - <