diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bcd9b0..e36b591 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,25 +7,20 @@ on: branches: [main, develop] jobs: - build: + lint: runs-on: ubuntu-latest - + name: Lint + steps: + - uses: tetherto/oss-actions/node-base@v1 + - run: npm run lint + test: + strategy: + matrix: + include: + - os: ubuntu-latest + platform: linux + runs-on: ${{ matrix.os }} + name: Test / ${{ matrix.platform }} steps: - - uses: actions/checkout@v3 - - name: Set up Node 22.19.0 - uses: actions/setup-node@v4 - with: - node-version: '22.19.0' - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm clean-install - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Lint code with standard - run: npm run lint - - - name: Run tests - run: npm test \ No newline at end of file + - uses: tetherto/oss-actions/node-base@v1 + - run: npm test diff --git a/.github/workflows/public-publish.yml b/.github/workflows/public-publish.yml new file mode 100644 index 0000000..911ea20 --- /dev/null +++ b/.github/workflows/public-publish.yml @@ -0,0 +1,35 @@ +name: Release to public npm +run-name: "Release (${{ inputs.bump }}${{ inputs.preid && format('-{0}', inputs.preid) || '' }})" +on: + workflow_dispatch: + inputs: + bump: + description: Version bump type + required: true + type: choice + options: + - patch + - minor + - major + - prerelease + preid: + description: Pre-release identifier + required: false + type: string + tag: + description: npm dist-tag + required: false + default: 'latest' + type: string +permissions: + contents: write + id-token: write +jobs: + release: + uses: tetherto/oss-actions/.github/workflows/public-publish.yml@main + with: + bump: ${{ inputs.bump }} + preid: ${{ inputs.preid }} + tag: ${{ inputs.tag }} + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 1dae277..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: publish - -on: - release: - types: [published] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Node 22.19.0 - uses: actions/setup-node@v4 - with: - node-version: '22.19.0' - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm clean-install - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Lint code with standard - run: npm run lint - - - name: Run tests - run: npm test - - publish: - needs: test - runs-on: ubuntu-latest - environment: npm-publish - - steps: - - uses: actions/checkout@v3 - - - name: Set up Node 22.19.0 - uses: actions/setup-node@v4 - with: - node-version: '22.19.0' - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm clean-install - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file