fix config gitaction for insiders release #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Insiders | |
on: | |
pull_request: | |
branches: | |
- develop | |
types: [closed] | |
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: | |
version_release: ${{ steps.get_version_release.outputs.version_release }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: New prerelease version | |
id: get_version_release | |
run: | | |
version=$(npm version prerelease --preid=insiders --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 add package.json | |
git commit -a -m "publish insiders 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=insiders --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 }}" | |
npm publish --tag insiders | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |