Skip to content

Publish build

Publish build #106

Workflow file for this run

name: Publish build
on:
workflow_dispatch:
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Bump version
run: |
git config user.email "[email protected]"
git config user.name "$GITHUB_ACTOR"
echo $(awk -F. '{OFS="."; $NF++; print}' VERSION) > VERSION
VERSION=$(cat VERSION)
git add VERSION
git commit -m "Bump version to $VERSION"
git tag $VERSION
git push --follow-tags
git push --tags
publish:
needs: version
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goosarch: [ linux/amd64, darwin/arm64 ]
steps:
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Get OS and arch info
run: |
GOOSARCH=${{matrix.goosarch}}
GOOS=${GOOSARCH%/*}
GOARCH=${GOOSARCH#*/}
BINARY_NAME=${{github.repository}}-worker-$GOOS-$GOARCH
VERSION=$(cat VERSION)
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV
echo "GOOS=$GOOS" >> $GITHUB_ENV
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
echo "TAG_NAME=$VERSION" >> $GITHUB_ENV
- name: Build
run: |
go build -o "$BINARY_NAME" -ldflags="-X 'main.Version=$TAG_NAME'" -v ./cmd/worker
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: false
files: ${{env.BINARY_NAME}}
tag_name: ${{env.TAG_NAME}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}