Skip to content

v0.1.1

v0.1.1 #1

Workflow file for this run

name: Release
on:
release:
types: [created]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: darwin
goarch: amd64
ext: tar.gz
- goos: darwin
goarch: arm64
ext: tar.gz
- goos: linux
goarch: amd64
ext: tar.gz
- goos: linux
goarch: arm64
ext: tar.gz
- goos: windows
goarch: amd64
ext: zip
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
TAG="${GITHUB_REF_NAME}"
BINARY="odoo-work-cli"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY="odoo-work-cli.exe"
fi
go build -ldflags "-X github.com/seletz/odoo-work-cli/internal/version.Version=${TAG}" \
-o "${BINARY}" ./cmd/odoo-work-cli
- name: Package
run: |
TAG="${GITHUB_REF_NAME}"
BINARY="odoo-work-cli"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY="odoo-work-cli.exe"
fi
ARCHIVE="odoo-work-cli-${TAG}-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.ext }}" = "tar.gz" ]; then
tar czf "${ARCHIVE}.tar.gz" "${BINARY}"
else
zip "${ARCHIVE}.zip" "${BINARY}"
fi
- name: Upload artifact
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
ARCHIVE="odoo-work-cli-${TAG}-${{ matrix.goos }}-${{ matrix.goarch }}.${{ matrix.ext }}"
gh release upload "$TAG" "$ARCHIVE" --repo "${{ github.repository }}"
checksums:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
gh release download "$TAG" --dir assets --repo "${{ github.repository }}"
- name: Generate checksums
run: |
TAG="${GITHUB_REF_NAME}"
cd assets
sha256sum * > "checksums-${TAG}.txt"
- name: Upload checksums
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
gh release upload "$TAG" "assets/checksums-${TAG}.txt" --repo "${{ github.repository }}"