chore: restructure npm package and revert version to 0.4.9 #1
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: Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.1 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6.1.0 | |
| with: | |
| go-version: "1.24.5" | |
| - name: Run tests | |
| run: go test ./... | |
| build: | |
| name: Build binaries | |
| needs: tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| artifact_name: opencore-linux-amd64 | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| artifact_name: opencore-darwin-amd64 | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| artifact_name: opencore-darwin-arm64 | |
| - os: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| artifact_name: opencore-windows-amd64.exe | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.1 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6.1.0 | |
| with: | |
| go-version: "1.24.5" | |
| - name: Get dependencies | |
| run: go mod download | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -ldflags "-X main.version=${{ github.ref_name }}" -o ${{ matrix.artifact_name }} . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.artifact_name }} | |
| publish-npm: | |
| name: Publish to NPM | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6.1.0 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update package version | |
| working-directory: ./npm | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| npm version $VERSION --no-git-tag-version --allow-same-version | |
| - name: Publish to NPM | |
| working-directory: ./npm | |
| run: npm publish --access public --provenance | |
| release: | |
| name: Create Release | |
| needs: publish-npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.1 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7.0.0 | |
| with: | |
| path: ./artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| find ./artifacts -type f -exec cp {} ./release/ \; | |
| ls -lah ./release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2.5.0 | |
| with: | |
| files: ./release/* | |
| draft: false | |
| prerelease: false | |
| body_path: RELEASE.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |