Skip to content

Publish

Publish #55

Workflow file for this run

name: Publish
on:
push:
tags:
- '*/v*'
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# Build with latest version of Go
tools:
name: Tool
needs: create_release
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
tool:
- cssh/cscp
- cssh/cssh
- clitable/cmd/csvtable
- grepp
- joinlines
- yaml-parse
- password-cache/cmd/password-cache
- cli-bookmarks
- ffind
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.x
cache-dependency-path: "${{ matrix.tool }}/go.sum"
- id: build
name: Build
run: |
go build -v .
dir=$(basename $PWD)
echo "dir: $dir"
echo "binary=$dir" >> $GITHUB_OUTPUT
working-directory: ${{ matrix.tool }}
shell: bash
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Ensure only tools matching the tag are released
if: ${{ (contains(github.ref, steps.build.outputs.binary) || contains(github.ref, 'all')) }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ matrix.tool }}/${{ steps.build.outputs.binary }}
asset_name: ${{ steps.build.outputs.binary }}.${{ matrix.goos }}.${{ matrix.goarch }}
asset_content_type: application/octet-stream