Skip to content

Release Draft

Release Draft #54

Workflow file for this run

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release Draft
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta-[0-9]+"
workflow_dispatch:
inputs:
tag_name:
description: "Release tag name (e.g. v1.2.3 or v1.2.3-beta-1)"
required: true
type: string
jobs:
release-draft:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Determine and validate tag
id: resolve-tag
env:
INPUT_TAG_NAME: ${{ inputs.tag_name }}
EVENT_NAME: ${{ github.event_name }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
TAG="$INPUT_TAG_NAME"
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-beta-[0-9]+)?$'; then
echo "Error: Tag '$TAG' does not match expected format (e.g. v1.2.3 or v1.2.3-beta-1)"
exit 1
fi
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
echo "Error: Tag '$TAG' already exists"
exit 1
fi
else
TAG="${GITHUB_REF_NAME}"
fi
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "./go.mod"
cache: true
cache-dependency-path: "go.sum"
- name: Update VERSION file
env:
RESOLVED_VERSION: ${{ steps.resolve-tag.outputs.version }}
run: echo "$RESOLVED_VERSION" > VERSION
- name: Cache frontend build
id: cache-frontend-build
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
pkg/server/dist
pkg/model/khifile/v6/style/assets
scripts/msdf-generator/zzz_generated_used_icons.json
web/angular.json
web/src/environments/version*
scripts/make/*.done
key: frontend-build-${{ runner.os }}-${{ hashFiles('web/src/**', 'web/package-lock.json', 'web/angular-template.json', 'web/tsconfig*.json', 'web/.browserslistrc', 'proto/**', 'buf.gen.yaml', 'pkg/model/enum/**', 'pkg/task/inspection/**', 'scripts/generate-angular-json.sh', 'scripts/generate-version.sh', 'scripts/frontend-codegen/**', 'scripts/fontlist-gen/**', 'scripts/msdf-generator/**', '.node-version', 'VERSION') }}
- name: Touch frontend build artifact dummy
if: steps.cache-frontend-build.outputs.cache-hit == 'true'
run: |
touch scripts/make/build-proto.done
make generate-backend
touch web/angular.json web/src/environments/version*
touch scripts/msdf-generator/zzz_generated_used_icons.json
touch scripts/make/generate-font-atlas.done
touch scripts/make/generate-frontend.done
touch pkg/server/dist/browser/build-web.done
- name: Setup Node.js
if: steps.cache-frontend-build.outputs.cache-hit != 'true'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: "./.node-version"
cache: "npm"
cache-dependency-path: "web/package-lock.json"
- name: Cache woff2_decompress binary
if: steps.cache-frontend-build.outputs.cache-hit != 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: scripts/msdf-generator/vendor/woff2/woff2_decompress
key: woff2-bin-${{ runner.os }}-${{ hashFiles('scripts/msdf-generator/setup.sh') }}
- name: Cache font atlas
if: steps.cache-frontend-build.outputs.cache-hit != 'true'
id: cache-font-atlas
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
web/src/assets/zzz-*
pkg/model/khifile/v6/style/assets
scripts/msdf-generator/zzz_generated_used_icons.json
scripts/make/generate-font-atlas.done
key: font-atlas-${{ runner.os }}-${{ hashFiles('scripts/msdf-generator/**', 'scripts/fontlist-gen/**', 'pkg/task/inspection/**') }}
- name: Touch font atlas dummy
if: steps.cache-frontend-build.outputs.cache-hit != 'true' && steps.cache-font-atlas.outputs.cache-hit == 'true'
run: |
touch scripts/make/build-proto.done
touch scripts/make/generate-backend.done
touch scripts/msdf-generator/zzz_generated_used_icons.json
touch scripts/make/generate-font-atlas.done
touch scripts/make/generate-frontend.done
- name: Install Frontend Dependencies
if: steps.cache-frontend-build.outputs.cache-hit != 'true'
run: |
cd web
npm ci
- name: Build Binaries
run: make build-go-binaries
- name: Push release tag
if: github.event_name == 'workflow_dispatch'
env:
RESOLVED_TAG: ${{ steps.resolve-tag.outputs.tag_name }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$RESOLVED_TAG"
git push origin "$RESOLVED_TAG"
- name: Create Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
tag_name: ${{ steps.resolve-tag.outputs.tag_name }}
draft: true
generate_release_notes: true
files: bin/*