Skip to content

Handle numeric checklist completedTime values #7

Handle numeric checklist completedTime values

Handle numeric checklist completedTime values #7

Workflow file for this run

name: Release
on:
push:
branches:
- main
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build binary
shell: bash
run: |
set -euo pipefail
mkdir -p dist
ext=""
if [[ "${{ matrix.goos }}" == "windows" ]]; then
ext=".exe"
fi
out="ticktick-${{ matrix.goos }}-${{ matrix.goarch }}${ext}"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
build_version="${GITHUB_REF_NAME}"
else
build_version="main-${GITHUB_SHA::7}"
fi
build_commit="${GITHUB_SHA::7}"
build_date="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" CGO_ENABLED=0 \
go build -trimpath \
-ldflags="-s -w -X 'main.version=${build_version}' -X 'main.commit=${build_commit}' -X 'main.buildDate=${build_date}'" \
-o "dist/${out}" ./cmd/ticktick
(cd dist && sha256sum "${out}" > "${out}.sha256")
tar -czf "dist/${out}.tar.gz" -C dist "${out}" "${out}.sha256"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ticktick-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/ticktick-${{ matrix.goos }}-${{ matrix.goarch }}*.tar.gz
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute release metadata
id: meta
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
tag_name="${GITHUB_REF_NAME}"
prerelease="false"
else
git fetch --tags --force
latest_patch="$(git tag -l 'v0.1.*' | sed -E 's/^v0\.1\.([0-9]+)$/\1/' | sort -n | tail -n1)"
if [[ -z "${latest_patch}" ]]; then
next_patch="1"
else
next_patch="$((latest_patch + 1))"
fi
tag_name="v0.1.${next_patch}"
prerelease="true"
fi
echo "tag_name=${tag_name}" >> "${GITHUB_OUTPUT}"
echo "prerelease=${prerelease}" >> "${GITHUB_OUTPUT}"
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag_name }}
target_commitish: ${{ github.sha }}
prerelease: ${{ steps.meta.outputs.prerelease }}
generate_release_notes: true
files: release-assets/**/*.tar.gz