feat: add new functionality #21
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| goreleaser: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| continue-on-error: true | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GORELEASER_PAT || secrets.GITHUB_TOKEN }} | |
| CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} | |
| publish-npm: | |
| needs: goreleaser | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Publish to NPM | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| cat <<EOF > package.json | |
| { | |
| "name": "fcemail", | |
| "version": "${VERSION}", | |
| "description": "FreeCustom.Email CLI — Manage disposable inboxes from your terminal.", | |
| "bin": { | |
| "fce": "bin/fce" | |
| }, | |
| "scripts": { | |
| "postinstall": "node scripts/install-binary.js" | |
| }, | |
| "repository": { | |
| "type": "git", | |
| "url": "git+https://github.com/DishIs/fce-cli.git" | |
| }, | |
| "author": "DishIs", | |
| "license": "MIT" | |
| } | |
| EOF | |
| # Create a minimal install script for NPM users | |
| mkdir -p bin | |
| touch bin/fce | |
| mkdir -p scripts | |
| cat <<EOF > scripts/install-binary.js | |
| const { execSync } = require('child_process'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| console.log('Downloading fce-cli binary...'); | |
| try { | |
| execSync('curl -fsSL https://raw.githubusercontent.com/DishIs/fce-cli/main/scripts/install.sh | BIN_DIR=./bin sh'); | |
| } catch (err) { | |
| console.error('Failed to download binary:', err.message); | |
| process.exit(1); | |
| } | |
| EOF | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |