Skip to content

Commit

Permalink
test cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Nycolaide committed Jan 30, 2025
1 parent dbd2290 commit 7358879
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
File renamed without changes.
117 changes: 117 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Release

on:
push:
branches:
- svelte-5-gitaction

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Use linter
run: npm run lint

- name: Build mytril
run: npm run build

prepublish:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
outputs:
local_version: ${{ steps.get_version_local.outputs.local_version }}
version_release: ${{ steps.get_version_release.outputs.version_release }}

steps:
- uses: actions/checkout@v4

- name: Get version from package.json
id: get_version_local
run: |
LOCAL_VERSION=$(node -p "require('./package.json').version")
echo "Local version: $LOCAL_VERSION"
echo "local_version=$LOCAL_VERSION" >> $GITHUB_ENV
- name: Check if version is insider
if: contains(${{ steps.get_version_local.outputs.local_version }}, 'insiders')
run: |
echo "Version contains 'insiders', skipping publication."
exit 1
- name: New prerelease version
id: get_version_release
run: |
version=$(npm version prerelease --preid=latest --no-git-tag-version)
echo "Generated version: $version"
echo "version_release=${version}" >> $GITHUB_OUTPUT
- name: Inspect the working tree
run: |
echo "Inspecting Git status and diff..."
git status
git diff
- name: Commit & Push version change
if: github.event_name == 'push'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git branch --show-current
git commit -a -m "publish release - ${{ steps.get_version_release.outputs.version_release }}"
git status
# git push
publish:
runs-on: ubuntu-latest
needs: prepublish
env:
version_release: ${{ needs.prepublish.outputs.version_release }}

steps:
- uses: actions/checkout@v4

- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: New prerelease version
run: npm version prerelease --preid=latest --no-git-tag-version

- name: Authenticate to NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
- name: Build
run: npm run build

- name: Verify files
run: npm pack --dry-run

- name: Inspect the working tree
run: echo "The current branch is ${{ env.version_release }}"

- name: Publish to NPM
run: |
echo "Publishing version ${{ env.version_release }}"
env:
NODE_AUTH_TOKEN:
${{ secrets.NPM_AUTH_TOKEN }}

#npm publish --tag insiders

0 comments on commit 7358879

Please sign in to comment.