Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ergofriend committed Oct 5, 2024
1 parent 5fd6a53 commit 6a2e129
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 98 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/bump.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 0 additions & 20 deletions .github/workflows/lint.yml

This file was deleted.

75 changes: 47 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,78 @@
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 '[email protected]/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
run: pnpm zip && pnpm zip:firefox
- 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

0 comments on commit 6a2e129

Please sign in to comment.