Skip to content

Merge pull request #13 from newcore-network/fix/hotfix-external-config #18

Merge pull request #13 from newcore-network/fix/hotfix-external-config

Merge pull request #13 from newcore-network/fix/hotfix-external-config #18

Workflow file for this run

name: Publish
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
pipeline:
name: Build (${{ matrix.goos }}-${{ matrix.goarch }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
artifact: opencore-linux-amd64
isPublisher: false
- goos: darwin
goarch: amd64
artifact: opencore-darwin-amd64
isPublisher: false
- goos: darwin
goarch: arm64
artifact: opencore-darwin-arm64
isPublisher: false
- goos: windows
goarch: amd64
artifact: opencore-windows-amd64.exe
isPublisher: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24.5"
- name: Go tests
if: ${{ matrix.isPublisher }}
run: go test ./...
- 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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
- name: Setup Node
if: ${{ matrix.isPublisher }}
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Update package version
if: ${{ matrix.isPublisher }}
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Resolve release channel
if: ${{ matrix.isPublisher }}
id: channel
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [[ "$VERSION" == *-* ]]; then
echo "channel=beta" >> "$GITHUB_OUTPUT"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "channel=latest" >> "$GITHUB_OUTPUT"
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish to NPM (Trusted Publisher)
if: ${{ matrix.isPublisher }}
env:
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""
run: npm publish --access public --provenance --tag "${{ steps.channel.outputs.channel }}"
- name: Download all artifacts
if: ${{ matrix.isPublisher }}
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Prepare release assets
if: ${{ matrix.isPublisher }}
shell: bash
run: |
mkdir -p release
find ./artifacts -type f -maxdepth 2 -exec cp {} ./release/ \;
ls -lah ./release/
- name: Create GitHub Release
if: ${{ matrix.isPublisher }}
uses: softprops/action-gh-release@v2
with:
files: ./release/*
draft: false
prerelease: ${{ steps.channel.outputs.prerelease }}
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}