diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml deleted file mode 100644 index 243ec86..0000000 --- a/.github/workflows/bump.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Bump version" - -permissions: - checks: write - statuses: write - contents: write - -on: - workflow_dispatch: - inputs: - version: - required: true - default: "patch" - type: choice - options: - - major - - minor - - patch - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - run: corepack enable - - name: Setup - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: "pnpm" - - name: Bump version - id: bump_version - shell: bash - run: | - pnpm version ${{ github.event.inputs.version }} --no-commit-hooks --no-git-tag-version - echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT - - id: branch - run: echo "ENV=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - - name: commit - run: | - gh api graphql \ - -F githubRepository=${{ github.repository }} \ - -F branchName=${{ steps.branch.outputs.ENV }} \ - -F expectedHeadOid=$(git rev-parse HEAD) \ - -F commitMessage=":robot: Bump version to ${{ steps.bump_version.outputs.VERSION }}" \ - -F files[][path]="package.json" -F files[][contents]=$(base64 -w0 package.json) \ - -F 'query=@.github/api/createCommitOnBranch.gql' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d6c266a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: ci + +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - run: corepack enable + - name: Setup + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - run: pnpm i --frozen-lockfile + - run: pnpm run ci + compile: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - run: corepack enable + - name: Setup + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - run: pnpm i --frozen-lockfile + - run: pnpm run compile diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 1804c75..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: lint - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - run: corepack enable - - name: Setup - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: "pnpm" - - name: Install - run: pnpm i --frozen-lockfile - - name: lint - run: pnpm run ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2db605e..0c1374a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,52 +1,71 @@ name: release +permissions: + checks: write + statuses: write + contents: write + on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: inputs: version: required: true - type: string - description: 'Deploy version without "v" ( ex: *.*.* )' - default: "" + default: "patch" + type: choice + options: + - major + - minor + - patch jobs: - build: + bump: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Get version from tag - id: variables + - run: corepack enable + - name: Setup + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - name: Bump version + id: bump_version shell: bash run: | - VERSION='' - if [ "${{ github.event_name }}" = "push" ]; then - VERSION="${GITHUB_REF#refs/tags/v}" - elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - VERSION="${{ github.event.inputs.version }}" - else - echo "Invalid event type" - exit 1 - fi - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - - name: Check same version + pnpm version ${{ github.event.inputs.version }} --no-commit-hooks --no-git-tag-version + echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT + - id: branch + run: echo "ENV=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + - name: commit run: | - echo "VERSION=${{ steps.variables.outputs.VERSION }}" - echo "package.json version=$(jq -r '.version' package.json)" - if [ "${{ steps.variables.outputs.VERSION }}" != "$(jq -r '.version' package.json)" ]; then - echo "Version is not same" - exit 1 - fi - shell: bash + gh api graphql \ + -F githubRepository=${{ github.repository }} \ + -F branchName=${{ steps.branch.outputs.ENV }} \ + -F expectedHeadOid=$(git rev-parse HEAD) \ + -F commitMessage=":robot: Bump version to ${{ steps.bump_version.outputs.VERSION }}" \ + -F files[][path]="package.json" -F files[][contents]=$(base64 -w0 package.json) \ + -F 'query=@.github/api/createCommitOnBranch.gql' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + outputs: + TAG: v${{ steps.bump_version.outputs.VERSION }} + build: + needs: bump + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: refs/tag/${{ needs.bump.outputs.TAG }} - run: corepack enable - name: Setup uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" + - id: version + run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT - name: Install run: pnpm i --frozen-lockfile - name: Build @@ -54,6 +73,6 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: - tag_name: v${{ steps.variables.outputs.VERSION }} + tag_name: v${{ steps.version.outputs.VERSION }} files: .output/*.zip generate_release_notes: true