chore: first commit #1
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: Squish CI/CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [ created ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
release: | |
name: Release | |
needs: test | |
if: github.event_name == 'release' && github.event.action == 'created' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: | | |
GOOS=linux GOARCH=amd64 go build -o squish-linux-amd64 | |
GOOS=darwin GOARCH=amd64 go build -o squish-darwin-amd64 | |
GOOS=windows GOARCH=amd64 go build -o squish-windows-amd64.exe | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./squish-linux-amd64 | |
asset_name: squish-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets (MacOS) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./squish-darwin-amd64 | |
asset_name: squish-darwin-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets (Windows) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./squish-windows-amd64.exe | |
asset_name: squish-windows-amd64.exe | |
asset_content_type: application/octet-stream | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish to npm | |
run: pnpm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |