From 0e8dd91b9fe0914b758acbbc776e7d226e3e1c13 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 8 Aug 2023 15:49:20 +0200 Subject: [PATCH] ci: single publish action template (#118) * rename yml to yaml * ci: single publish action template * chore: add alpha publish scripts --------- Co-authored-by: Eugene Chybisov --- .../yarn-install/{action.yml => action.yaml} | 0 .github/workflows/{deploy.yml => deploy.yaml} | 0 .../{publish-beta.yml => publish.yaml} | 5 ++- .github/workflows/publish.yml | 37 ------------------- package.json | 6 ++- 5 files changed, 8 insertions(+), 40 deletions(-) rename .github/actions/yarn-install/{action.yml => action.yaml} (100%) rename .github/workflows/{deploy.yml => deploy.yaml} (100%) rename .github/workflows/{publish-beta.yml => publish.yaml} (78%) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/actions/yarn-install/action.yml b/.github/actions/yarn-install/action.yaml similarity index 100% rename from .github/actions/yarn-install/action.yml rename to .github/actions/yarn-install/action.yaml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yaml similarity index 100% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy.yaml diff --git a/.github/workflows/publish-beta.yml b/.github/workflows/publish.yaml similarity index 78% rename from .github/workflows/publish-beta.yml rename to .github/workflows/publish.yaml index 750ef7ea6..d13554461 100644 --- a/.github/workflows/publish-beta.yml +++ b/.github/workflows/publish.yaml @@ -3,7 +3,9 @@ name: Release & Publish Beta on: push: tags: + - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+' workflow_dispatch: jobs: @@ -32,6 +34,7 @@ jobs: - name: Build run: yarn release:build - name: Publish to npm - run: yarn release:publish:beta + run: | + yarn release:publish${{ contains(github.ref_name, 'alpha') && ':alpha' || contains(github.ref_name, 'beta') && ':beta' || '' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 908969c35..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Release & Publish - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - uses: ./.github/actions/yarn-install - - name: Build - run: yarn release:build - - name: Publish to npm - run: yarn release:publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 701d9aadb..f0cb681fb 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,14 @@ "start": "lerna run start", "build": "lerna run build", "release": "yarn release:version:before && yarn release:version && yarn release:version:after && yarn standard-version -a", - "release:beta": "yarn release:version:before && yarn release:version && yarn release:version:after && yarn standard-version -a --prerelease beta --skip.changelog", - "release:version": "lerna version --preid beta --no-changelog --no-push --no-git-tag-version --no-private", + "release:alpha": "yarn release:version:before && yarn release:version --preid alpha && yarn release:version:after && yarn standard-version -a --prerelease alpha --skip.changelog", + "release:beta": "yarn release:version:before && yarn release:version --preid beta && yarn release:version:after && yarn standard-version -a --prerelease beta --skip.changelog", + "release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private", "release:version:before": "node scripts/private-version before", "release:version:after": "yarn release:build && node scripts/private-version after", "release:build": "lerna run build --no-private", "release:publish": "lerna publish from-package --dist-tag latest --contents build --no-verify-access --yes", + "release:publish:alpha": "lerna publish from-package --dist-tag alpha --contents build --no-verify-access --yes", "release:publish:beta": "lerna publish from-package --dist-tag beta --contents build --no-verify-access --yes" }, "standard-version": {