Skip to content

Commit

Permalink
ci(release): fix changesets release ci (#6)
Browse files Browse the repository at this point in the history
* ci(release): fix changesets release ci

* ci(test): remove publish in test

* ci(release): fix permission

* ci(test): remove on pull request

* ci(test): set to workflow call only

* ci(release): add needs option

* ci(test): remove cancel in progress

* ci(test): remove concurrency option

* ci(release): try upgrade permission

* ci: reset workflow `on` option

* ci: set up concurrency

* ci(release): add checkout name
  • Loading branch information
fu050409 authored Jul 19, 2024
1 parent 79de82a commit c8e7e4c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .changeset/slimy-waves-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
push:
branches:
- main

concurrency: "release ${{ github.workflow }}-${{ github.ref }}"

permissions: write-all

jobs:
build-and-test:
name: Build and Test
uses: ./.github/workflows/test.yml

release:
name: Release
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Set NPM Provenance
run: npm config set provenance true
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
title: 'chore(release): version packages'
commit: 'chore(release): version packages'
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
46 changes: 4 additions & 42 deletions .github/workflows/CI.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build and Test
env:
DEBUG: napi:*
APP_NAME: ntscl
Expand All @@ -7,7 +7,7 @@ env:
permissions:
contents: write
id-token: write
'on':
on:
push:
branches:
- main
Expand All @@ -20,8 +20,9 @@ permissions:
- .editorconfig
- docs/**
pull_request: null
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
Expand Down Expand Up @@ -390,42 +391,3 @@ jobs:
set -e
yarn test
ls -la
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- build-freebsd
- test-macOS-windows-binding
- test-linux-x64-gnu-binding
- test-linux-x64-musl-binding
- test-linux-aarch64-gnu-binding
- test-linux-aarch64-musl-binding
- test-linux-arm-gnueabihf-binding
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Set NPM Provenance
run: npm config set provenance true
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit c8e7e4c

Please sign in to comment.